public static function normaliseItems(array $items): array
    {
        // merge item properties with defaults
        $items = self::applyDefaults($items);

        // merge duplicated labels recursively
        $result = [];
        foreach ($items as $item) {
            if (!array_key_exists($item['label'], $result)) {
                $result[$item['label']] = $item;
                continue;
            }

            $result[$item['label']]['children'] = array_merge_recursive(
                $item['children'],
                $result[$item['label']]['children']
            );
        }

        return $result;
    }
public static function normaliseItems(array $items): array
    {
        // merge item properties with defaults
        $items = self::applyDefaults($items);

        // merge duplicated labels recursively
        $result = [];
        foreach ($items as $item) {
            if (!array_key_exists($item['label'], $result)) {
                $result[$item['label']] = $item;
                continue;
            }

            $result[$item['label']]['children'] = array_merge_recursive(
                $item['children'],
                $result[$item['label']]['children']
            );
        }

        return $result;
    }
public static function normaliseItems ( array $ items ) : array { // merge item properties with defaults $ items = self :: applyDefaults ( $ items ) ; // merge duplicated labels recursively $ result = [ ] ; foreach ( $ items as $ item ) { if ( ! array_key_exists ( $ item [ 'label' ] , $ result ) ) { $ result [ $ item [ 'label' ] ] = $ item ; continue ; } $ result [ $ item [ 'label' ] ] [ 'children' ] = array_merge_recursive ( $ item [ 'children' ] , $ result [ $ item [ 'label' ] ] [ 'children' ] ) ; } return $ result ; }
Normalises the provided array menu items for the given module
Part of the normalisation is to
- merge duplicated labels, recursively
- apply defaults defined in Menu.defaults, recursively

@param mixed[] $items Menu items
@return mixed[]
Normalises the provided array menu items for the given module Part of the normalisation is to - merge duplicated labels recursively - apply defaults defined in Menu . defaults recursively