/** * Dispatches a widget * @param \ride\library\mvc\Request $request * @param \ride\library\mvc\Response $response * @param integer $widgetId Id of the widget instance * @param \ride\library\cms\widget\Widget $widget Instance of the widget * @return null */ protected function dispatchWidget(Request $request, Response $response, $widgetId, Widget $widget) { $routeArgumentsMatched = false; $callback = null; $widget->setIdentifier($widgetId); $widget->setLocale($this->locale); $widget->setRegion($this->region); $widget->setSection($this->section); $widget->setBlock($this->block); $route = $request->getRoute(); $route->setIsDynamic(false); $widgetRoutes = $widget->getRoutes(); if ($widgetRoutes && $this->routeArguments) { $widgetRouteContainer = new RouteContainer(); foreach ($widgetRoutes as $widgetRoute) { $widgetRouteContainer->addRoute($widgetRoute); } $path = '/' . implode('/', $this->routeArguments); $this->router->setRouteContainer($widgetRouteContainer); $routeResult = $this->router->route($request->getMethod(), $path, $widgetRoutes); $widgetRoute = $routeResult->getRoute(); if ($widgetRoute) { $callback = $widgetRoute->getCallback(); $route->setArguments($widgetRoute->getArguments()); $route->setIsDynamic($widgetRoute->isDynamic()); $routeArgumentsMatched = true; } } else { $route->setArguments(array()); $route->setIsDynamic(false); } if (!$callback) { $callback = $widget->getCallback(); } $route->setCallback($callback); $this->dispatcher->dispatch($request, $response); return $routeArgumentsMatched; }
/** * Checks if this action is available for the widget * @param \ride\library\cms\node\Node $node * @param \ride\library\cms\widget\Widget $widget * @return boolean true if available */ public function isAvailableForWidget(Node $node, Widget $widget) { return $widget->getPropertiesCallback() ? true : false; }
/** * Checks if this action is available for the widget * @param ride\library\cms\node\Node $node * @param ride\library\cms\widget\Widget $widget * @return boolean true if available */ public function isAvailableForWidget(Node $node, Widget $widget) { return $widget instanceof StyleWidget && $widget->getWidgetStyleOptions() ? true : false; }
/** * Checks if this action is available for the widget * @param \ride\library\cms\node\Node $node * @param \ride\library\cms\widget\Widget $widget * @return boolean true if available */ public function isAvailableForWidget(Node $node, Widget $widget) { return $widget->getTemplates() ? true : false; }