protected function components()
    {
        $function = function (array $params = null) {
            try {
                $this->gridStackAdapter->scripts();

                if (!empty($params)) {
                    return app('ui-components')->findAllByResourceAndNames(uri(), $params);
                }
                return app('ui-components')->findAllByResource(uri());
            } catch (Exception $e) {
                Log::emergency($e);
                return [];
            }
        };
        return new Twig_SimpleFunction(
                'components', $function
        );
    }