heimrichhannot/contao-archive-palettes-bundle
最新稳定版本:1.2.0
Composer 安装命令:
composer require heimrichhannot/contao-archive-palettes-bundle
包简介
This bundle offers functionality for selecting custom palettes depending on the parent archive for the backend of the Contao CMS.
README 文档
README
This bundle offers functionality for selecting custom palettes depending on the parent archive for the backend of the Contao CMS.
Features
- add custom palettes to your DCA files
- select them in the parent archive
Setup
-
Install via composer:
composer require heimrichhannot/contao-archive-palettes-bundle. -
Adjust your project configuration
Example for tl_news:
# config/config.yml huh_archive_palettes: tables: tl_news: # The table where the custom palettes should be applied parent: "tl_news_archive" # The archive table where custom palette should be selected palette_parent: "comments_legend" # A legend or a field after which the palette selector should be inserted in the parent table palette
-
Clear cache and update your database
Configuration
Configuration via yaml
# Default configuration for extension with alias: "huh_archive_palettes" huh_archive_palettes: # The tables that should be extended with the archive palette. tables: # Example: tl_news # Prototype name: # The parent (archive) table. parent: ~ # Required, Example: tl_news_archive # A field or a parent where the should be added after. palette_parent: ~ # Required
Configuration via PHP
- Open the DCA file you'd like to extend. As an example we use
tl_news. It should be located in your project bundle. - Create the custom field palettes as you would normally:
// ... $dca['palettes']['custom_palette1'] = '{general_legend},field1,field2;'; $dca['palettes']['custom_palette2'] = '{general_legend},field3,field4;';
- Paste the following code at the end of the DCA file in order to insert the palette manipulation logic:
System::getContainer()->get(\HeimrichHannot\ArchivePalettesBundle\Manager\ArchivePalettesManager::class)->addArchivePalettesSupportForChild( 'tl_news', 'tl_news_archive' );
- Open the parent DCA file, i.e. the archive DCA file. In the case of
tl_newsthis would betl_news_archive. - Paste the following code at the end of the DCA file in order to insert the palette manipulation logic:
System::getContainer()->get(\HeimrichHannot\ArchivePalettesBundle\Manager\ArchivePalettesManager::class)->addArchivePalettesSupportForArchive( 'tl_news', 'tl_news_archive' );
- Add the following code at the end of the file in order to add the palette selector field (the field as been added in the step before):
// ... $dca['palettes']['default'] = $dca['palettes']['default'] . ';{archive_palettes_legend},addArchivePalette;';
- Clear the project cache and update the database in order to add the needed fields.
- Open archive's configuration (
editheaderoperation in most cases) and set the custom palette to your needs.
统计信息
- 总下载量: 1.33k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-or-later
- 更新时间: 2020-06-17