src/Charcoal/Admin/Ui/ActionContainerTrait.php
protected function parseActions(array $actions, $renderer = false)
    {
        $this->actionsPriority = $this->defaultActionPriority();

        $parsedActions = [];
        foreach ($actions as $ident => $action) {
            $ident  = $this->parseActionIdent($ident, $action);
            $action = $this->parseActionItem($action, $ident, $renderer);

            if (!isset($action['priority'])) {
                $action['priority'] = $this->actionsPriority++;
            }

            if (isset($parsedActions[$ident])) {
                $hasPriority = ($action['priority'] > $parsedActions[$ident]['priority']);
                if ($hasPriority || $action['isSubmittable']) {
                    $parsedActions[$ident] = array_replace($parsedActions[$ident], $action);
                } else {
                    $parsedActions[$ident] = array_replace($action, $parsedActions[$ident]);
                }
            } else {
                $parsedActions[$ident] = $action;
            }
        }

        usort($parsedActions, [ $this, 'sortActionsByPriority' ]);

        while (($first = reset($parsedActions)) && $first['isSeparator']) {
            array_shift($parsedActions);
        }

        while (($last = end($parsedActions)) && $last['isSeparator']) {
            array_pop($parsedActions);
        }

        return $parsedActions;
    }
protected function parseActions(array $actions, $renderer = false)
    {
        $this->actionsPriority = $this->defaultActionPriority();

        $parsedActions = [];
        foreach ($actions as $ident => $action) {
            $ident  = $this->parseActionIdent($ident, $action);
            $action = $this->parseActionItem($action, $ident, $renderer);

            if (!isset($action['priority'])) {
                $action['priority'] = $this->actionsPriority++;
            }

            if (isset($parsedActions[$ident])) {
                $hasPriority = ($action['priority'] > $parsedActions[$ident]['priority']);
                if ($hasPriority || $action['isSubmittable']) {
                    $parsedActions[$ident] = array_replace($parsedActions[$ident], $action);
                } else {
                    $parsedActions[$ident] = array_replace($action, $parsedActions[$ident]);
                }
            } else {
                $parsedActions[$ident] = $action;
            }
        }

        usort($parsedActions, [ $this, 'sortActionsByPriority' ]);

        while (($first = reset($parsedActions)) && $first['isSeparator']) {
            array_shift($parsedActions);
        }

        while (($last = end($parsedActions)) && $last['isSeparator']) {
            array_pop($parsedActions);
        }

        return $parsedActions;
    }
protected function parseActions ( array $ actions , $ renderer = false ) { $ this -> actionsPriority = $ this -> defaultActionPriority ( ) ; $ parsedActions = [ ] ; foreach ( $ actions as $ ident => $ action ) { $ ident = $ this -> parseActionIdent ( $ ident , $ action ) ; $ action = $ this -> parseActionItem ( $ action , $ ident , $ renderer ) ; if ( ! isset ( $ action [ 'priority' ] ) ) { $ action [ 'priority' ] = $ this -> actionsPriority ++ ; } if ( isset ( $ parsedActions [ $ ident ] ) ) { $ hasPriority = ( $ action [ 'priority' ] > $ parsedActions [ $ ident ] [ 'priority' ] ) ; if ( $ hasPriority || $ action [ 'isSubmittable' ] ) { $ parsedActions [ $ ident ] = array_replace ( $ parsedActions [ $ ident ] , $ action ) ; } else { $ parsedActions [ $ ident ] = array_replace ( $ action , $ parsedActions [ $ ident ] ) ; } } else { $ parsedActions [ $ ident ] = $ action ; } } usort ( $ parsedActions , [ $ this , 'sortActionsByPriority' ] ) ; while ( ( $ first = reset ( $ parsedActions ) ) && $ first [ 'isSeparator' ] ) { array_shift ( $ parsedActions ) ; } while ( ( $ last = end ( $ parsedActions ) ) && $ last [ 'isSeparator' ] ) { array_pop ( $ parsedActions ) ; } return $ parsedActions ; }
Parse the given UI actions.

@param  array $actions  Actions to resolve.
@param  mixed $renderer Either a {@see ViewableInterface} or TRUE
to determine if any renderables should be processed.
@return array Returns a collection of parsed actions.
Parse the given UI actions .