protected function _categoryToXML(Category $category, $categories) { // store category attributes $attributes = array(); foreach (self::$category_attributes as $attribute) { if (isset($category->{$attribute})) { $attributes[$attribute] = $category->{$attribute}; } } // store category parent if (isset($categories[$category->parent])) { $attributes['parent'] = $categories[$category->parent]->alias; } // build category $category_xml = $this->_buildCategory($category->alias, $category->name, $attributes); // store category params if ($category->alias == '_root') { $params = $this->_application->getMetaXML()->xpath('params[@group="application-content"]/param'); $category_params = $this->_application->getParams(); } else { $params = $this->_application->getMetaXML()->xpath('params[@group="category-content"]/param'); $category_params = $category->getParams(); } foreach ($params as $param) { $type = (string) $param->attributes()->type; $name = (string) $param->attributes()->name; switch ($type) { case 'zooimage': if ($path = $category_params->get('content.' . $name, '')) { $this->_attachCategoryImage($category_xml, $path, (string) $param->attributes()->label, $category_params->get('content.' . $name . '_width'), $category_params->get('content.' . $name . '_height')); } break; case 'text': case 'textarea': if ($value = $category_params->get('content.' . $name, '')) { $this->_attachCategoryParam($category_xml, $type, $value, (string) $param->attributes()->label); } break; } } return $category_xml; }
/** * Add a category to the exporing list * * @param Category $category The category to export * * @return AppExporterZoo2 $this for chaining support * * @since 2.0 */ protected function _addZooCategory(Category $category) { // store category attributes $data = array(); foreach ($this->category_attributes as $attribute) { if (isset($category->{$attribute})) { $data[$attribute] = $category->{$attribute}; } } // store category parent if (isset($this->_categories[$category->parent])) { $data['parent'] = $this->_categories[$category->parent]->alias; } // store category content params $data['content'] = $category->alias == '_root' ? $this->_application->getParams()->get('content.') : $category->getParams()->get('content.'); // store category metadata params $data['metadata'] = $category->alias == '_root' ? $this->_application->getParams()->get('metadata.') : $category->getParams()->get('metadata.'); parent::_addCategory($category->name, $category->alias, $data); }