protected function getMenuItem(EntityInterface $menu, array $item, int $order = 0): array
    {
        if (empty($item)) {
            return [];
        }

        $label = $item['label'];
        $icon = $item['icon'];
        $type = $item['type'];

        $children = !empty($item['children']) ? $item['children'] : [];

        if (!empty($children)) {
            $count = 0;
            foreach ($children as $key => $child) {
                $children[$key] = $this->getMenuItem($menu, $child, ++$count);
            }
        }

        if (static::TYPE_MODULE === $type) {
            $item = $this->getMenuItemsFromEvent($menu->get('name'), [$item['url']]);
            reset($item);
            $item = current($item);
        }

        if (!empty($children)) {
            $item['children'] = $children;
        }

        if (empty($item)) {
            return [];
        }

        if (static::TYPE_MODULE === $type) {
            $item['label'] = $label;
            $item['icon'] = $icon;
        }

        $item['order'] = $order;

        return $item;
    }
protected function getMenuItem(EntityInterface $menu, array $item, int $order = 0): array
    {
        if (empty($item)) {
            return [];
        }

        $label = $item['label'];
        $icon = $item['icon'];
        $type = $item['type'];

        $children = !empty($item['children']) ? $item['children'] : [];

        if (!empty($children)) {
            $count = 0;
            foreach ($children as $key => $child) {
                $children[$key] = $this->getMenuItem($menu, $child, ++$count);
            }
        }

        if (static::TYPE_MODULE === $type) {
            $item = $this->getMenuItemsFromEvent($menu->get('name'), [$item['url']]);
            reset($item);
            $item = current($item);
        }

        if (!empty($children)) {
            $item['children'] = $children;
        }

        if (empty($item)) {
            return [];
        }

        if (static::TYPE_MODULE === $type) {
            $item['label'] = $label;
            $item['icon'] = $icon;
        }

        $item['order'] = $order;

        return $item;
    }
protected function getMenuItem ( EntityInterface $ menu , array $ item , int $ order = 0 ) : array { if ( empty ( $ item ) ) { return [ ] ; } $ label = $ item [ 'label' ] ; $ icon = $ item [ 'icon' ] ; $ type = $ item [ 'type' ] ; $ children = ! empty ( $ item [ 'children' ] ) ? $ item [ 'children' ] : [ ] ; if ( ! empty ( $ children ) ) { $ count = 0 ; foreach ( $ children as $ key => $ child ) { $ children [ $ key ] = $ this -> getMenuItem ( $ menu , $ child , ++ $ count ) ; } } if ( static :: TYPE_MODULE === $ type ) { $ item = $ this -> getMenuItemsFromEvent ( $ menu -> get ( 'name' ) , [ $ item [ 'url' ] ] ) ; reset ( $ item ) ; $ item = current ( $ item ) ; } if ( ! empty ( $ children ) ) { $ item [ 'children' ] = $ children ; } if ( empty ( $ item ) ) { return [ ] ; } if ( static :: TYPE_MODULE === $ type ) { $ item [ 'label' ] = $ label ; $ item [ 'icon' ] = $ icon ; } $ item [ 'order' ] = $ order ; return $ item ; }
Menu item getter.

@param \Cake\Datasource\EntityInterface $menu Menu entity
@param mixed[] $item Menu item
@param int $order Menu item order
@return mixed[]
Menu item getter .