spooner-web / slug-extbase
更新前端中更改或创建 Extbase 对象后的 slug 字段的小工具
1.0.3
2021-02-02 15:45 UTC
Requires
- php: ^7.2
- typo3/cms-core: ^9.5 || ^10.4
- typo3/cms-extbase: ^9.5 || ^10.4
This package is auto-updated.
Last update: 2024-09-14 15:46:58 UTC
README
它做什么?
一般来说,slug 字段在后台更改或在 DataHandler 中更改时都会更新。
但是,使用前端表单更改 Extbase 模型对 slug 字段没有影响。
此扩展提供了一个用于在 Extbase 模型中使用的接口。
通过适当的 TCA 配置,如果配置的其中一个表字段被更改,它会自动更新 slug 字段。
安装
通过 composer
composer require spooner-web/slug-extbase
通过扩展管理器
- 从 TER 或扩展管理器内部下载扩展
- 激活包
用法
将提供的接口 \SpoonerWeb\SlugExtbase\SlugEntityInterface
添加到您的 Extbase 模型中,例如。
class MyModel extends TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements \SpoonerWeb\SlugExtbase\SlugEntityInterface
就是这样。
好的,您需要在数据库中有一个 slug 字段,以及为其设置的 TCA 配置。
无论您通过前端表单创建或更新 Extbase 模型,都会发生神奇的事情,slug 字段都会按照您的配置更新。
致敬
感谢 12bis3 提供使用接口和自动更新 slug 的想法!