src/Menu/MenuConfigInterpreter.php
protected function interpretNestedGroupLayout(array $data)
    {
        foreach ($data as $key => &$value) {

            if ( ! is_array($value)) {
                continue;
            }

            // The child is a group, so make a presence object for it
            $children = array_get($value, 'children', []);
            $children = $this->interpretNestedGroupLayout($children);

            $value = new MenuPresence([
                'id'               => $key ?: array_get($value, 'id'),
                'type'             => MenuPresenceType::GROUP,
                'label'            => array_get($value, 'label'),
                'label_translated' => array_get($value, 'label_translated'),
                'icon'             => array_get($value, 'icon'),
                'children'         => $children,
            ]);
        }

        unset ($value);

        return $data;
    }
protected function interpretNestedGroupLayout(array $data)
    {
        foreach ($data as $key => &$value) {

            if ( ! is_array($value)) {
                continue;
            }

            // The child is a group, so make a presence object for it
            $children = array_get($value, 'children', []);
            $children = $this->interpretNestedGroupLayout($children);

            $value = new MenuPresence([
                'id'               => $key ?: array_get($value, 'id'),
                'type'             => MenuPresenceType::GROUP,
                'label'            => array_get($value, 'label'),
                'label_translated' => array_get($value, 'label_translated'),
                'icon'             => array_get($value, 'icon'),
                'children'         => $children,
            ]);
        }

        unset ($value);

        return $data;
    }
protected function interpretNestedGroupLayout ( array $ data ) { foreach ( $ data as $ key => & $ value ) { if ( ! is_array ( $ value ) ) { continue ; } // The child is a group, so make a presence object for it $ children = array_get ( $ value , 'children' , [ ] ) ; $ children = $ this -> interpretNestedGroupLayout ( $ children ) ; $ value = new MenuPresence ( [ 'id' => $ key ? : array_get ( $ value , 'id' ) , 'type' => MenuPresenceType :: GROUP , 'label' => array_get ( $ value , 'label' ) , 'label_translated' => array_get ( $ value , 'label_translated' ) , 'icon' => array_get ( $ value , 'icon' ) , 'children' => $ children , ] ) ; } unset ( $ value ) ; return $ data ; }
Interprets nested groups in a layout array, creating presences for them.

@param array $data
@return array
Interprets nested groups in a layout array creating presences for them .