/** * 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; }
public function let(LaravelApplicationWrapper $wrapper) { $this->beConstructedWith($this->config, $wrapper); WidgetId::reset(); }
/** * 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; }
/** * Get the current widget container id. * * @return string */ public function getContainerId() { return 'brainkit-widget-container-' . WidgetId::get(); }