Allow / Disallow CTypes

This requires the extension ichhabrecht/content-defender to be installed.

It is possible to allow and disallow CTypes when registering your container configurations, as well as set a maxitems

See Content Defender README

Typically you would want to set these in your initial columnConfiguration (see Register containers with EXT:container-wrap)

'columnConfiguration' => [
    [
        [
            'name' => 'Content',
            'colPos' => 100,
            'allowed' => [
                'CType' => 'textmedia',
            ],
        ],
    ],
]
Copied!
'columnConfiguration' => [
    [
        [
            'name' => 'Sidebar',
            'colPos' => 100,
            'disallowed' => [
                'CType' => 'list',
            ],
        ],
    ],
]
Copied!

In the scenario where you want to allow or disallow CTypes after you have registered the containers, e.g. in a theme extension, simply call the corresponding functions

allowInAllContainers(array $cTypes, array $exceptions = [])

allowInAllContainers(array $cTypes, array $exceptions = [])
cTypes

an array of CTypes that should be (additionally) allowed in all containers

exceptions

(Optional) an array of container CTypes where this change should NOT be applied

The given CTypes are added to the allowed CTypes of all containers.

allowInSpecificContainers(array $cTypes, array $allowInContainers, array $allowInColumns = [])

allowInSpecificContainers(array $cTypes, array $allowInContainers, array $allowInColumns = [])
cTypes

an array of CTypes that should be (additionally) allowed in all containers

allowInContainers

an array of container CTypes, where this change should be applied

allowInColumns

(Optional) an array of columns where this change should be applied, if omitted the change will be applied to all columns of the container

The given CTypes are added to the allowed CTypes of the given containers

allowInAllContainers(array $cTypes, array $exceptions = [])

allowInAllContainers(array $cTypes, array $exceptions = [])
cTypes

an array of CTypes that should be (additionally) allowed in all containers

exceptions

(Optional) an array of container CTypes where this change should NOT be applied

The given CTypes are added to the allowed CTypes of all containers.

disallowInSpecificContainers(array $cTypes, array $disallowInContainers, array $disallowInColumns = [])

disallowInSpecificContainers(array $cTypes, array $disallowInContainers, array $disallowInColumns = [])
cTypes

an array of CTypes that should be (additionally) allowed in all containers

allowInContainers

an array of container CTypes, where this change should be applied

allowInColumns

(Optional) an array of columns where this change should be applied, if omitted the change will be applied to all columns of the container

The given CTypes are added to the allowed CTypes of the given containers

//disallow any list-plugin in all containers
\TRAW\ContainerWrap\Configuration\Container::disallowInAllContainers(['list']);

//disallow image CType in my-container-1 and my-containr-2 if the colPos is 101 or 102
\TRAW\ContainerWrap\Configuration\Container::disallowInSpecificContainers(
    ['image'],
    ['my-container-1', 'my-container-2'],
    [101, 102]
);

//allow textmedia CType in all containers, except my-container-1
\TRAW\ContainerWrap\Configuration\Container::allowInAllContainers(['textmedia'], ['my-container-1']);
Copied!