protected function getAll()
    {
        $widgets = getConfig('Widgets.general', []);

        if ($this->getView()->getRequest()->isUrl(['_name' => 'homepage']) && getConfig('Widgets.homepage')) {
            $widgets = getConfig('Widgets.homepage');
        }

        return $widgets ? collection($widgets)->map(function ($args, $name) {
            if (is_string($name) && is_array($args)) {
                return [$name => $args];
            } elseif (is_string($args)) {
                return [$args => []];
            }

            list($name, $args) = [array_key_first($args), array_value_first($args)];

            return is_int($name) && is_string($args) ? [$args => []] : [$name => $args];
        })->toList() : [];
    }
protected function getAll()
    {
        $widgets = getConfig('Widgets.general', []);

        if ($this->getView()->getRequest()->isUrl(['_name' => 'homepage']) && getConfig('Widgets.homepage')) {
            $widgets = getConfig('Widgets.homepage');
        }

        return $widgets ? collection($widgets)->map(function ($args, $name) {
            if (is_string($name) && is_array($args)) {
                return [$name => $args];
            } elseif (is_string($args)) {
                return [$args => []];
            }

            list($name, $args) = [array_key_first($args), array_value_first($args)];

            return is_int($name) && is_string($args) ? [$args => []] : [$name => $args];
        })->toList() : [];
    }
protected function getAll ( ) { $ widgets = getConfig ( 'Widgets.general' , [ ] ) ; if ( $ this -> getView ( ) -> getRequest ( ) -> isUrl ( [ '_name' => 'homepage' ] ) && getConfig ( 'Widgets.homepage' ) ) { $ widgets = getConfig ( 'Widgets.homepage' ) ; } return $ widgets ? collection ( $ widgets ) -> map ( function ( $ args , $ name ) { if ( is_string ( $ name ) && is_array ( $ args ) ) { return [ $ name => $ args ] ; } elseif ( is_string ( $ args ) ) { return [ $ args => [ ] ] ; } list ( $ name , $ args ) = [ array_key_first ( $ args ) , array_value_first ( $ args ) ] ; return is_int ( $ name ) && is_string ( $ args ) ? [ $ args => [ ] ] : [ $ name => $ args ] ; } ) -> toList ( ) : [ ] ; }
Internal method to get all widgets
@return array
Internal method to get all widgets