/** * Update cache definition procedure * * @param afsWidgetModel $widget * @return Widget * @author Sergey Startsev */ public function update($widget) { if ($widget->isNew()) { return $this; } $method_name = 'process' . ucfirst(strtolower($widget->getType())); if (method_exists($this, $method_name)) { $this->definition[$widget->getPlace()][$widget->getModule()][$widget->getAction()] = call_user_func(array($this, $method_name), $widget->getDefinition()); } return $this; }
/** * Getting widget info * * @param afsWidgetModel $widget * @return array * @author Sergey Startsev */ public static function getInfo(afsWidgetModel $widget) { $module_dir = $widget->getPlaceModulePath(); $place_config_path = $widget->getPlaceConfigPath(); $action = $widget->getAction(); $module = $widget->getModule(); $place = $widget->getPlace(); $place_type = $widget->getPlaceType(); $actionPath = "{$module_dir}/actions/actions.class.php"; $predictActions = "{$action}Action.class.php"; $predictActionsPath = "{$module_dir}/actions/{$predictActions}"; if (file_exists($predictActionsPath)) { $actionPath = $predictActionsPath; } $actionName = pathinfo($actionPath, PATHINFO_BASENAME); // Info response $info = array('place' => $place, 'placeType' => $place_type, 'module' => $module, 'widgetUri' => "{$module}/{$action}", 'securityPath' => "{$place_config_path}/security.yml", 'xmlPath' => "{$place_config_path}/{$action}.xml", 'actionPath' => $actionPath, 'actionName' => $actionName, 'name' => $action); return $info; }
/** * If i:fields url attribute is not set we are generating it with default id parameter * * @param array $definition * @param afsWidgetModel $widgetModel * @return array * @author Łukasz Wojciechowski */ private function checkAndCreateFieldsUrlAttribute(array $definition, afsWidgetModel $widgetModel) { if (isset($definition['i:fields'])) { $fields = $definition['i:fields']; if (!isset($fields['attributes']['url'])) { $fields['attributes']['url'] = $widgetModel->getModule() . '/' . $widgetModel->getAction() . '?id={id}'; } $definition['i:fields'] = $fields; } return $definition; }