Cockpit-HQ / Cockpit

Cockpit Core - Content Platform
https://getcockpit.com
Other
329 stars 40 forks source link

[Feature] Adjust fields of standard components #185

Open pozylon opened 1 week ago

pozylon commented 1 week ago

For our needs we now had to add a "Button customized" component taking a select of "primary", "secondary" and "tertiary". Issue is we can still see the "Button" in every Layout Builder where as we don't want to allow the use of that Button, they should use "Button customized" instead.

Standard components can not be adjusted through the "Layout Components" and can't be hidden either

pozylon commented 1 week ago

related to https://github.com/Cockpit-HQ/Cockpit/issues/179 but it's not quite the same

aheinze commented 1 week ago

a quick fix regarding the unwanted standard components:

in /config/bootstrap.php:

<?php

$app->on('layout.components.collect', function($components) {

    foreach (array_keys($components->getArrayCopy()) as $component) {

        //disable specific components
        if (in_array($component, ['button'])) {
            unset($components[$component]);
        }
    }
});
aheinze commented 1 week ago

For the next version I plan a setting in the pages addon for allowed components that can be used in the layout page type. Would that help you?