jsemajtacka/text-block

简单的 Nette 框架文本块扩展。

2.0.0 2023-07-17 11:44 UTC

This package is auto-updated.

Last update: 2024-09-17 14:25:28 UTC


README

这是一个简单的 Nette 框架文本块扩展。

警告!此扩展期望使用 Contributte Translation 来获取当前区域设置,以及 Contributte Doctrine-extensions-knplabs 来进行 TextBlock 翻译。

安装

使用 Composer 安装此扩展

$ composer reguire jsemajtacka/text-block

配置

将此添加到您的配置 .neon 文件中

extensions:
    textBlock: JsemAjtacka\TextBlock\DI\TextBlockExtension

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

使用示例

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"}