Crud\Controller\Component\CrudComponent::defaults PHP Method

defaults() public method

Set or get defaults for listeners and actions.
public defaults ( string $type, string | array $name, mixed $config = null ) : mixed
$type string Can be anything, but 'listeners' or 'actions' is currently only used.
$name string | array The name of the $type - e.g. 'api', 'relatedModels' or an array ('api', 'relatedModels'). If $name is an array, the $config will be applied to each entry in the $name array.
$config mixed If NULL, the defaults is returned, else the defaults are changed.
return mixed
    public function defaults($type, $name, $config = null)
    {
        if ($config !== null) {
            if (!is_array($name)) {
                $name = [$name];
            }
            foreach ($name as $realName) {
                $this->config(sprintf('%s.%s', $type, $realName), $config);
            }
            return null;
        }
        return $this->config(sprintf('%s.%s', $type, $name));
    }