src/Charcoal/Admin/Ui/ActionContainerTrait.php
protected function parseActionCondition($condition, $action = null, $renderer = null)
    {
        unset($action);

        if ($renderer === null) {
            $renderer = $this->getActionRenderer();
        }

        if (is_bool($condition)) {
            return $condition;
        } elseif (is_string($condition)) {
            $not = ($condition[0] === '!');
            if ($not) {
                $condition = ltrim($condition, '!');
            }

            $result = null;
            if ($renderer && is_callable([ $renderer, $condition ])) {
                $result = !!$renderer->{$condition}();
            } elseif (is_callable([ $this, $condition ])) {
                $result = !!$this->{$condition}();
            } elseif (is_callable($condition)) {
                $result = !!$condition();
            } elseif ($renderer) {
                $result = !!$renderer->renderTemplate($condition);
            }

            if ($result !== null) {
                return $not ? !$result : $result;
            }
        }

        return $condition;
    }
protected function parseActionCondition($condition, $action = null, $renderer = null)
    {
        unset($action);

        if ($renderer === null) {
            $renderer = $this->getActionRenderer();
        }

        if (is_bool($condition)) {
            return $condition;
        } elseif (is_string($condition)) {
            $not = ($condition[0] === '!');
            if ($not) {
                $condition = ltrim($condition, '!');
            }

            $result = null;
            if ($renderer && is_callable([ $renderer, $condition ])) {
                $result = !!$renderer->{$condition}();
            } elseif (is_callable([ $this, $condition ])) {
                $result = !!$this->{$condition}();
            } elseif (is_callable($condition)) {
                $result = !!$condition();
            } elseif ($renderer) {
                $result = !!$renderer->renderTemplate($condition);
            }

            if ($result !== null) {
                return $not ? !$result : $result;
            }
        }

        return $condition;
    }
protected function parseActionCondition ( $ condition , $ action = null , $ renderer = null ) { unset ( $ action ) ; if ( $ renderer === null ) { $ renderer = $ this -> getActionRenderer ( ) ; } if ( is_bool ( $ condition ) ) { return $ condition ; } elseif ( is_string ( $ condition ) ) { $ not = ( $ condition [ 0 ] === '!' ) ; if ( $ not ) { $ condition = ltrim ( $ condition , '!' ) ; } $ result = null ; if ( $ renderer && is_callable ( [ $ renderer , $ condition ] ) ) { $ result = ! ! $ renderer -> { $ condition } ( ) ; } elseif ( is_callable ( [ $ this , $ condition ] ) ) { $ result = ! ! $ this -> { $ condition } ( ) ; } elseif ( is_callable ( $ condition ) ) { $ result = ! ! $ condition ( ) ; } elseif ( $ renderer ) { $ result = ! ! $ renderer -> renderTemplate ( $ condition ) ; } if ( $ result !== null ) { return $ not ? ! $ result : $ result ; } } return $ condition ; }
Parse the given UI action conditional check.

@param  mixed $condition The action's conditional check.
@param  mixed $action    The action structure.
@param  mixed $renderer  The renderer.
@return array Resolved action structure.
Parse the given UI action conditional check .