lumturo-net/contao-globals-wrapper
Composer 安装命令:
composer require lumturo-net/contao-globals-wrapper
包简介
Ein objektorientierter Wrapper für das GLOBALS Array in Contao
README 文档
README
Eine Contao Extension die das arbeiten mit DCAs extrem erleichtert.
Entwickelt mit PHP7.3 und Contao 4.9.
Installation
Installation via composer
composer require lumturo-net/contao-globals-wrapper
TL_DCA
use LumturoNet\Globals\Dca; $dca = Dca::new(string $namespace);
Konfigurationen
$dca->config() ->dataContainer('Table') ->cTable(['tl_tabelle']) ->enableVersioning() ->custom([ // Eigene Konfigurationsfelder ]) ->sql([ 'keys' => ['id' => 'primary'] ]);
Vorhandene Konfiguration erweitern
$dca->config([bool $extend])
Exceptions
DcaConfigNotSetException
Wird zurückgegeben wenn
$extend = trueund zu erweiternde Konfiguration nicht vorhanden ist.
Listen
$dca->list() ->sorting() ->fields(['title']) ->mode(1) ->flag(11) ->panelLayout('search;filter') ->compile() ->label() ->fields(['title']) ->compile() ->globalOperations('all') ->label($label) ->href() ->class() ->attributes() ->compile() ->operations('edit') ->href() ->icon() ->compile()
Vorhandene Liste erweitern
$dca->list([bool $extend])
Exceptions
DcaListNotSetException
Wird zurückgegeben wenn
$extend = trueund die zu erweiternde Liste nicht vorhanden ist.
Felder
$dca->fields('mein_feld') ->text() ->label(string|array $label) ->exclude() ->eval() ->mandatory() ->maxlength(255) ->compile() ->relation([ 'hasOne' => 'lazy' ]) ->sql()
Vorhandenes Feld erweitern
$dca->field('singleSRC', [bool $extend])
Exceptions
DcaFieldExistsException
Wird zurückgegeben wenn
$extend = falseund Feld mit selben Namen im selben Namespace erstellt werden soll.
DcaFieldNotSetException
Wird zurückgegeben wenn
$extend = trueund das zu erweiterndes Feld nicht vorhanden ist.
Paletten & Subpaletten
$dca->palettes(string $palette) ->group('title_legend' [string $translations, boolean $hidden]) ->fields([ 'mein_feld', 'anderes_feld', 'nochein_feld' ]) ->compile() $dca->subpalette('mein_feld') ->fields([ 'unterfeld_1', 'unterfeld_2' ]) ->compile();
TL_CTE
Mit Cte::new($namespace)->push(Array []) können Mappings
von Inhaltselementen zu ihren respektiven Klassen definiert
werden.
use LumturoNet\Globals\Cte; use Namespace\Elements\MyCustomElement1; use Namespace\Elements\MyCustomElement2; use Namespace\Elements\MyCustomElement3; Cte::new(string $namespace)->push([ 'MyCustomElement1' => MyCustomElement1::class, 'MyCustomElement2' => MyCustomElement2::class, 'MyCustomElement3' => MyCustomElement3::class, ]);
TL_LANG
Mit dem Language Wrapper können sowohl neue Übersetzungen erstellt, als auch aus existierenden Übersetzungen entsprechende Werte ausgelesen werden.
Übersetzung erstellen
use LumturoNet\Globals\Lang; $lang = Lang::set($namespace); $lang->trans('MyCustomElement1', 'Ein cooles Inhaltselement') ->trans('MyCustomElement2', 'Und noch eins') ->trans('MyCustomElement3', 'Elemente gründen Gewerkschaft'); ->trans('sharkday', ['Haitag', 'Es ist Haitag']);
Übersetzungen holen
use LumturoNet\Globals\Lang; Lang::set($namespace); $dca->field('text') ->label(__('sharkday'));
Übersetungen aus anderem Namespace holen
use LumturoNet\Globals\Lang; $dca->field('text') ->label(__('deleteConfirm', 'MSC'));
TL_MODELS
!! Ab Contao 4.9.x !!
Durch das Modelbinding ist es möglich, dass die Klassen der Models anders benannt sein können als die Tabellen in der Datenbank.
use LumturoNet\Globals\Models; use Namespace\Models\MyModel; use Namespace\Models\MySecondModel; Models::bind([ 'tl_tabelle' => MyModel:class, 'tl_tabelle_2' => MySecondModel::class, ... ]);
Exceptions
BindingExistsException
Wird zurückgegeben wenn eines der übergebenen Bindings bereits existiert
BE_MOD
use LumturoNet\Globals\Backend; Backend::new(string $namespace, string $module, [int $position = 1])->tables([ 'tl_tabelle_1', 'tl_tabelle_2', ... ]);
TL_HOOKS
use LumturoNet\Globals\Hooks; use Namespace\Hooks\AddCommentHook; $hooks = Hooks::get() $hooks->activateAccount(array $myCallback) ->addComment([AddCommentHook::class, 'addCommentHook']);
TL_CSS
use LumturoNet\Globals\Css; Css::push([ 'path/to/file1.css', 'path/to/file2.css', ... ]);
Exceptions
CssExistsException
Wird zurückgegeben wenn die hinzuzufügende CSS bereits in TL_CSS vorhanden ist
lumturo-net/contao-globals-wrapper 适用场景与选型建议
lumturo-net/contao-globals-wrapper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 37 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 07 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「wrapper」 「globals」 「contao」 「dca」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 lumturo-net/contao-globals-wrapper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lumturo-net/contao-globals-wrapper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 lumturo-net/contao-globals-wrapper 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Global variables and global constants from WordPress core.
php predefined variables facade
Contao Open Source CMS
Load link- or script-assets to the document from inside your TWIG template.
LinkedIn API PHP SDK with OAuth 2.0 & CSRF support. Can be used for social sign in or sharing on LinkedIn. Examples. Documentation.
Diese Contao 4 Erweiterung stellt Google reCAPTCHA V2 in Form eines neuen Formularfeldes im Formulargenerator bereit. This extension provides Google reCAPTCHA V2 in the form of a new form field in the form generator of Contao Open Source CMS.
统计信息
- 总下载量: 37
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-07-20