src/Charcoal/Admin/Widget/TableWidget.php
protected function parseAsListActions(array $actions)
    {
        $listActions = [];
        foreach ($actions as $ident => $action) {
            $ident  = $this->parseActionIdent($ident, $action);
            $action = $this->parseActionItem($action, $ident, true);

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

            if ($action['ident'] === 'create') {
                $action['empty'] = true;

                if (!$this->isObjCreatable()) {
                    $action['active'] = false;
                }
            } else {
                $action['empty'] = (isset($action['empty']) ? boolval($action['empty']) : false);
            }

            if (is_array($action['actions'])) {
                $action['actions']    = $this->parseAsListActions($action['actions']);
                $action['hasActions'] = !!array_filter($action['actions'], function ($action) {
                    return $action['active'];
                });
            }

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

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

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

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

        return $listActions;
    }
protected function parseAsListActions(array $actions)
    {
        $listActions = [];
        foreach ($actions as $ident => $action) {
            $ident  = $this->parseActionIdent($ident, $action);
            $action = $this->parseActionItem($action, $ident, true);

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

            if ($action['ident'] === 'create') {
                $action['empty'] = true;

                if (!$this->isObjCreatable()) {
                    $action['active'] = false;
                }
            } else {
                $action['empty'] = (isset($action['empty']) ? boolval($action['empty']) : false);
            }

            if (is_array($action['actions'])) {
                $action['actions']    = $this->parseAsListActions($action['actions']);
                $action['hasActions'] = !!array_filter($action['actions'], function ($action) {
                    return $action['active'];
                });
            }

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

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

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

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

        return $listActions;
    }
protected function parseAsListActions ( array $ actions ) { $ listActions = [ ] ; foreach ( $ actions as $ ident => $ action ) { $ ident = $ this -> parseActionIdent ( $ ident , $ action ) ; $ action = $ this -> parseActionItem ( $ action , $ ident , true ) ; if ( ! isset ( $ action [ 'priority' ] ) ) { $ action [ 'priority' ] = $ this -> actionsPriority ++ ; } if ( $ action [ 'ident' ] === 'create' ) { $ action [ 'empty' ] = true ; if ( ! $ this -> isObjCreatable ( ) ) { $ action [ 'active' ] = false ; } } else { $ action [ 'empty' ] = ( isset ( $ action [ 'empty' ] ) ? boolval ( $ action [ 'empty' ] ) : false ) ; } if ( is_array ( $ action [ 'actions' ] ) ) { $ action [ 'actions' ] = $ this -> parseAsListActions ( $ action [ 'actions' ] ) ; $ action [ 'hasActions' ] = ! ! array_filter ( $ action [ 'actions' ] , function ( $ action ) { return $ action [ 'active' ] ; } ) ; } if ( isset ( $ listActions [ $ ident ] ) ) { $ hasPriority = ( $ action [ 'priority' ] > $ listActions [ $ ident ] [ 'priority' ] ) ; if ( $ hasPriority || $ action [ 'isSubmittable' ] ) { $ listActions [ $ ident ] = array_replace ( $ listActions [ $ ident ] , $ action ) ; } else { $ listActions [ $ ident ] = array_replace ( $ action , $ listActions [ $ ident ] ) ; } } else { $ listActions [ $ ident ] = $ action ; } } usort ( $ listActions , [ $ this , 'sortActionsByPriority' ] ) ; while ( ( $ first = reset ( $ listActions ) ) && $ first [ 'isSeparator' ] ) { array_shift ( $ listActions ) ; } while ( ( $ last = end ( $ listActions ) ) && $ last [ 'isSeparator' ] ) { array_pop ( $ listActions ) ; } return $ listActions ; }
Parse the given actions as collection actions.

@param  array $actions Actions to resolve.
@return array
Parse the given actions as collection actions .