zoglo / contao-row-wizard
RowWizard for Contao Open Source CMS
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:contao-bundle
pkg:composer/zoglo/contao-row-wizard
Requires
- php: ^8.1
- codefog/contao-haste: ^5.3
- contao/core-bundle: ^5.3
- symfony/asset: ^6.4 || ^7.0
- symfony/dependency-injection: ^6.4 || ^7.0
- symfony/event-dispatcher: ^6.4 || ^7.0
- symfony/http-kernel: ^6.4 || ^7.0
Requires (Dev)
Conflicts
- contao/manager-plugin: <2.0 || >=3.0
README
Warning
The Row-Wizard is now part of Contao 5.7 and does not need to be installed
Contao Row Wizard
Description
See contao/contao#8781 for the Contao feature (This bundle acts as a backport now).
This bundle adds a widget that allows adding multiple rows, with each row containing multiple widgets arranged as columns. The data can be stored as a serialized array in the database.
Installation
Via composer
composer require zoglo/contao-row-wizard
Configuration
use Contao\CoreBundle\DataContainer\PaletteManipulator; use Doctrine\DBAL\Platforms\AbstractMySQLPlatform; use Zoglo\RowWizardBundle\EventListener\ColumnWizardListener; $GLOBALS['TL_DCA']['tl_content']['fields']['columnWizardOne'] = [ 'label' => ['columnWizardOne', 'And some random description'], // Or a &$GLOBALS['TL_LANG'] pointer 'inputType' => 'rowWizard', 'fields' => [ 'type' => [ 'label' => ['Type'], // Or a &$GLOBALS['TL_LANG'] pointer 'inputType' => 'select', 'options' => ['foo', 'bar', 'baz', 'quux'], 'eval' => [ 'includeBlankOption' => true, 'chosen' => true, ], ], 'checkbox' => [ 'label' => ['Checkbox'], // Or a &$GLOBALS['TL_LANG'] pointer 'inputType' => 'checkbox', ], 'textarea' => [ 'label' => ['Textarea'], // Or a &$GLOBALS['TL_LANG'] pointer 'inputType' => 'textarea', ], 'text' => [ 'label' => ['Text'], // Or a &$GLOBALS['TL_LANG'] pointer 'inputType' => 'text', ], ], 'eval' => [ 'tl_class' => 'clr', 'actions' => [ // actions to be shown. Default: 'copy', 'delete' // 'edit' does not work yet 'copy', 'delete', //'enable', // Enable / Disable ], //'sortable' => false, // disables sorting the rows 'min' => 2, // minimum amount of rows 'max' => 5, // maximum amount of rows ], 'sql' => [ 'type' => 'blob', 'length' => AbstractMySQLPlatform::LENGTH_LIMIT_BLOB, 'notnull' => false, ], ];
Output
Examples
In some cases, you may not want to save any value if there is only one row and the first value is empty. You can implement your own callback function for the save callback like this:
#[AsCallback(table: 'tl_content', target: 'fields.columnWizardOne.save')] class ContentTextSaveCallback { public function __invoke($value, DataContainer $dc) { if ('' === $value) { return $value; } if (0 === \count($values = StringUtil::deserialize($value, true))) { return ''; } // Do not reset if there is more than one row if (1 !== \count($values)) { return $value; } if (($values[0][array_key_first($values[0])] ?? '') === '') { return ''; } return $value; } }
Known limitation
The following fields do not work:
- any eval
rte(tinymce, ace) - color picker
- filetree
If you need those working or any other special features, consider using a more advanced wizard such as contao-multicolumnwizard-bundle instead.
