Merge pull request #1687 from ArthurHoaro/feature/template-name
Inject current template name in templates
This commit is contained in:
commit
2fbdb7d657
2 changed files with 7 additions and 0 deletions
|
@ -56,6 +56,10 @@ abstract class ShaarliVisitorController
|
|||
|
||||
protected function render(string $template): string
|
||||
{
|
||||
// Legacy key that used to be injected by PluginManager
|
||||
$this->assignView('_PAGE_', $template);
|
||||
$this->assignView('template', $template);
|
||||
|
||||
$this->assignView('linkcount', $this->container->bookmarkService->count(BookmarkFilter::$ALL));
|
||||
$this->assignView('privateLinkcount', $this->container->bookmarkService->count(BookmarkFilter::$PRIVATE));
|
||||
|
||||
|
|
|
@ -93,6 +93,9 @@ class ShaarliVisitorControllerTest extends TestCase
|
|||
|
||||
static::assertSame('templateName', $render);
|
||||
|
||||
static::assertSame('templateName', $this->assignedValues['_PAGE_']);
|
||||
static::assertSame('templateName', $this->assignedValues['template']);
|
||||
|
||||
static::assertSame(10, $this->assignedValues['linkcount']);
|
||||
static::assertSame(5, $this->assignedValues['privateLinkcount']);
|
||||
static::assertSame(['error'], $this->assignedValues['plugin_errors']);
|
||||
|
|
Loading…
Reference in a new issue