From 657c0300336f5821cdd93d288d54ed49ff801346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Wed, 12 Oct 2016 15:11:29 +0200 Subject: [PATCH] DOC: add phpdoc --- app/Shortcodes/Widget.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/app/Shortcodes/Widget.php b/app/Shortcodes/Widget.php index bad16564..ac531540 100644 --- a/app/Shortcodes/Widget.php +++ b/app/Shortcodes/Widget.php @@ -19,6 +19,11 @@ class Widget return call_user_func([$presenter, 'render'], $widget); } + /** + * Load one widget from database + * + * @param $containerId + */ protected function loadWidget($containerId) { $widget = WidgetModel::where('container_id', $containerId) @@ -36,6 +41,11 @@ class Widget self::$widgets[$containerId] = $this->getRenderedWidget($widget); } + /** + * Load all frequently used widgets + * + * Frequency of loaded widgets is counted only using direct loading, widgets displayed in widget areas are omitted + */ protected function initWidgets() { if (self::$initialized) { @@ -53,6 +63,18 @@ class Widget self::$initialized = true; } + /** + * Register new shortcode + * + * Initfrequently used widgets and if not presented yet - load desired widget specified as content of shortcode + * + * @param $shortcode + * @param $containerId + * @param $compiler + * @param $name + * + * @return mixed + */ public function register($shortcode, $containerId, $compiler, $name) { $this->initWidgets();