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

0.1.0 2025-12-22 11:57 UTC

This package is auto-updated.

Last update: 2025-12-22 11:58:19 UTC


README

Warning

The Row-Wizard is now part of Contao 5.7 and does not need to be installed

Contao Row Wizard

github version amount of downloads minimum php version

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

Rendered example of the row wizard based on the configuration

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.