vrestihnat/title-control

Nette control for managing title in HTML header.

1.0.1 2021-01-17 19:18 UTC

This package is auto-updated.

Last update: 2024-10-25 18:02:21 UTC


README

Build Status Downloads this Month Latest stable

Installation

Via Composer:

$ composer require vrestihnat/title-control

Usage

First register the control factory in your config:

services:
    -
        implement: Vrestihnat\TitleControl\ITitleControlFactory

Use the control factory in your presenter:

protected function createComponentTitle(): Vrestihnat\TitleControl\TitleControl
{
    $control = $this->titleControlFactory->create();
    $control->setTitle('My title');
    return $control;
}

And render it in your Latte template:

<html>
<head>
    {control title}
</head>
<body>
    ...
</body>
</html>

We can also use multi title with a separator. Default separator is: ' | '

    $control->addItem('One')->addItem('Two'); // 'One | Two'

Change the separator:

    $control->setSeparator(' ~ ');

We can also use nette translator