src/Charcoal/Ui/Menu/AbstractMenu.php
public function items(callable $itemCallback = null)
    {
        $items = $this->items;
        uasort($items, [ $this, 'sortItemsByPriority' ]);

        $itemCallback = isset($itemCallback) ? $itemCallback : $this->itemCallback;
        foreach ($items as $item) {
            if ($itemCallback) {
                $itemCallback($item);
            }
            $GLOBALS['widget_template'] = $item->template();
            yield $item->ident() => $item;
            $GLOBALS['widget_template'] = '';
        }
    }
public function items(callable $itemCallback = null)
    {
        $items = $this->items;
        uasort($items, [ $this, 'sortItemsByPriority' ]);

        $itemCallback = isset($itemCallback) ? $itemCallback : $this->itemCallback;
        foreach ($items as $item) {
            if ($itemCallback) {
                $itemCallback($item);
            }
            $GLOBALS['widget_template'] = $item->template();
            yield $item->ident() => $item;
            $GLOBALS['widget_template'] = '';
        }
    }
public function items ( callable $ itemCallback = null ) { $ items = $ this -> items ; uasort ( $ items , [ $ this , 'sortItemsByPriority' ] ) ; $ itemCallback = isset ( $ itemCallback ) ? $ itemCallback : $ this -> itemCallback ; foreach ( $ items as $ item ) { if ( $ itemCallback ) { $ itemCallback ( $ item ) ; } $ GLOBALS [ 'widget_template' ] = $ item -> template ( ) ; yield $ item -> ident ( ) => $ item ; $ GLOBALS [ 'widget_template' ] = '' ; } }
Menu Item generator.

@param callable $itemCallback Optional. Item callback.
@return MenuItemInterface[]
Menu Item generator .