Exemplo n.º 1
0
 /**
  * Construct an AbstractWidget instance using the given Block entity
  *
  * @param CmsBlock $block Block entity
  * @param array $config Instance Config
  * @param bool $addToRegistry Whether to add this to the WidgetManager registry.
  * @return Cms\Widget\AbstractWidget
  */
 public static function factory(CmsBlock $block, array $config = [], $addToRegistry = true)
 {
     $widgetClass = $block->getWidgetClassName();
     $widget = new $widgetClass($block->widget, $config, $block);
     if ($addToRegistry) {
         WidgetManager::addToRegistry($widget);
     }
     return $widget;
 }