public static function applyDefaults(array $items, array $defaults = null): array
    {
        $defaults = empty($defaults) ? Configure::readOrFail('Menu.defaults') : $defaults;

        // merge item properties with defaults
        $func = function (&$item, $k) use (&$func, $defaults) {
            if (!empty($item['children'])) {
                array_walk($item['children'], $func);
            }

            $item = array_merge($defaults, $item);
        };
        array_walk($items, $func);

        return $items;
    }
public static function applyDefaults(array $items, array $defaults = null): array
    {
        $defaults = empty($defaults) ? Configure::readOrFail('Menu.defaults') : $defaults;

        // merge item properties with defaults
        $func = function (&$item, $k) use (&$func, $defaults) {
            if (!empty($item['children'])) {
                array_walk($item['children'], $func);
            }

            $item = array_merge($defaults, $item);
        };
        array_walk($items, $func);

        return $items;
    }
public static function applyDefaults ( array $ items , array $ defaults = null ) : array { $ defaults = empty ( $ defaults ) ? Configure :: readOrFail ( 'Menu.defaults' ) : $ defaults ; // merge item properties with defaults $ func = function ( & $ item , $ k ) use ( & $ func , $ defaults ) { if ( ! empty ( $ item [ 'children' ] ) ) { array_walk ( $ item [ 'children' ] , $ func ) ; } $ item = array_merge ( $ defaults , $ item ) ; } ; array_walk ( $ items , $ func ) ; return $ items ; }
Applies the menu defaults on the provided menu item.
Defaults will be loaded from Configuration Menu.defaults if the provided array is empty

@param mixed[] $items List of menu items
@param array|null $defaults List of default values for a menu item
@return mixed[] The provided list of menu items including the defaults
Applies the menu defaults on the provided menu item . Defaults will be loaded from Configuration Menu . defaults if the provided array is empty