dek-cz/title-control

Nette control for managing title in HTML header.

1.1.1 2021-03-05 18:44 UTC

This package is auto-updated.

Last update: 2024-10-22 09:30:39 UTC


README

Build Status Downloads this Month Latest stable Coverage Status

Installation

Via Composer:

$ composer require dek-cz/title-control

Usage

First register the control factory in your config:

services:
    -
        implement: Dekcz\TitleControl\ITitleControlFactory

Use the control factory in your presenter:

protected function createComponentTitle(): Dekcz\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