public function getDependents(View $view) { $widgetsStyles = array(); foreach (array_reverse($view->getWidgets()) as $widgetClass => $widgets) { /** @var Widget $widget */ foreach ($widgets as $widget) { $styleFile = $this->resolveStyleFile($widget->getView()); $styleFile && ($widgetsStyles[] = $styleFile); $widgetsStyles = array_merge($widgetsStyles, $this->getDependents($widget->getView())); } } return array_unique($widgetsStyles); }
protected function getDependents(View $view) { $widgetsIds = array(); foreach (array_reverse($view->getWidgets()) as $widgetClass => $widgets) { /** @var Widget $widget */ foreach ($widgets as $widget) { $scriptFile = sprintf('%s%s', $widget->getView()->getTemplatePath(), self::EXTENSION_SCRIPT); $isAppend = $this->appendScriptFile($widget->getView()->getId(), $scriptFile); $isAppend && ($widgetsIds[$widget->getName()] = array('name' => $widget->getView()->getId(), 'params' => $widget->getView()->getJsParams(), 'dependents' => $this->getDependents($widget->getView()))); } } return $widgetsIds; }