Exemplo n.º 1
0
 /**
  * Process the attributes of a category
  *
  * @param Zikula\Core\Doctrine\Entity\Category $category    The category to set the attributes for.
  * @param array $attrib_names                               The attribute names.
  * @param array $attrib_values                              The attribute values.
  *
  * @return none.
  */
 public static function processCategoryAttributes($category, $attrib_names, $attrib_values)
 {
     // delete attributes
     if (isset($category['attributes'])) {
         foreach ($category['attributes'] as $attribute) {
             if (!in_array($attribute['name'], $attrib_names)) {
                 $category->delAttribute($attribute['name']);
             }
         }
     }
     // add/update attributes
     foreach ($attrib_names as $attrib_key => $attrib_name) {
         if (!empty($attrib_name)) {
             $category->setAttribute($attrib_name, $attrib_values[$attrib_key]);
         }
     }
 }