DOC: add phpdoc
This commit is contained in:
@@ -19,6 +19,11 @@ class Widget
|
|||||||
return call_user_func([$presenter, 'render'], $widget);
|
return call_user_func([$presenter, 'render'], $widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load one widget from database
|
||||||
|
*
|
||||||
|
* @param $containerId
|
||||||
|
*/
|
||||||
protected function loadWidget($containerId)
|
protected function loadWidget($containerId)
|
||||||
{
|
{
|
||||||
$widget = WidgetModel::where('container_id', $containerId)
|
$widget = WidgetModel::where('container_id', $containerId)
|
||||||
@@ -36,6 +41,11 @@ class Widget
|
|||||||
self::$widgets[$containerId] = $this->getRenderedWidget($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()
|
protected function initWidgets()
|
||||||
{
|
{
|
||||||
if (self::$initialized) {
|
if (self::$initialized) {
|
||||||
@@ -53,6 +63,18 @@ class Widget
|
|||||||
self::$initialized = true;
|
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)
|
public function register($shortcode, $containerId, $compiler, $name)
|
||||||
{
|
{
|
||||||
$this->initWidgets();
|
$this->initWidgets();
|
||||||
|
|||||||
Reference in New Issue
Block a user