jsemajtacka/text-block

Simple Nette Framework extension for text blocks.

2.0.0 2023-07-17 11:44 UTC

This package is auto-updated.

Last update: 2024-10-17 14:38:47 UTC


README

This is a simple Nette Framework extension for Text Block.

Warning! This extension expects using Contributte Translation for retrieving the current locale and Contributte Doctrine-extensions-knplabs for the TextBlock translation.

Installation

Use Composer to install this extension:

$ composer reguire jsemajtacka/text-block

Configuration

Add this to your configuration .neon file:

extensions:
    textBlock: JsemAjtacka\TextBlock\DI\TextBlockExtension

textBlock:
    textBlockService: Path\To\Your\Text\Block\Service\Class

Example of usage

BasePresenter.php:

class BasePresenter extends Nette\Application\UI\Presenter
{
    #[Inject]
    public TextBlockFactory $textBlockFactory;

    protected function createComponentTextBlock(): TextBlockControl
    {
        return $this->textBlockFactory->create();
    }
}

@layout.latte:

{control textBlock "textBlockSlug"}