コード例 #1
0
 /**
  * Set class properties and instantiate a widget object.
  *
  * @param $params
  *
  * @throws InvalidWidgetClassException
  */
 protected function instantiateWidget(array $params = [])
 {
     WidgetId::increment();
     $this->widgetName = $this->parseFullWidgetNameFromString(array_shift($params));
     $this->widgetFullParams = $params;
     $this->widgetConfig = (array) array_shift($params);
     $this->widgetParams = $params;
     $widgetClass = class_exists($this->widgetName) ? $this->widgetName : $this->config['defaultNamespace'] . '\\' . $this->widgetName;
     $widget = new $widgetClass($this->widgetConfig);
     if ($widget instanceof AbstractWidget === false) {
         throw new InvalidWidgetClassException();
     }
     $this->widget = $widget;
 }
コード例 #2
0
 public function let(LaravelApplicationWrapper $wrapper)
 {
     $this->beConstructedWith($this->config, $wrapper);
     WidgetId::reset();
 }
コード例 #3
0
 /**
  * Set some specials variables to modify the workflow of the widget factory.
  *
  * @param Request $request
  */
 protected function prepareGlobals(Request $request)
 {
     WidgetId::set($request->input('id', 1) - 1);
     AbstractWidgetFactory::$skipWidgetContainer = true;
 }
コード例 #4
0
 /**
  * Get the current widget container id.
  *
  * @return string
  */
 public function getContainerId()
 {
     return 'brainkit-widget-container-' . WidgetId::get();
 }