Пример #1
0
 /**
  * Links the content object attribute and tag
  *
  * @static
  *
  * @param eZContentObjectAttribute $attribute
  * @param eZTagsObject $tagObject
  * @param string $keyword
  * @param string $locale
  */
 private static function linkTag(eZContentObjectAttribute $attribute, eZTagsObject $tagObject, $keyword, $locale, $priority)
 {
     $languageID = eZContentLanguage::idByLocale($locale);
     if ($languageID === false) {
         return;
     }
     if ($locale == $attribute->attribute('language_code')) {
         if (!$tagObject->hasTranslation($locale)) {
             $tagKeywordObject = new eZTagsKeyword(array('keyword_id' => $tagObject->attribute('id'), 'language_id' => $languageID, 'keyword' => $keyword, 'locale' => $locale, 'status' => eZTagsKeyword::STATUS_PUBLISHED));
             $tagKeywordObject->store();
             $tagObject->updateLanguageMask();
         }
     }
     $linkObject = new eZTagsAttributeLinkObject(array('keyword_id' => $tagObject->attribute('id'), 'objectattribute_id' => $attribute->attribute('id'), 'objectattribute_version' => $attribute->attribute('version'), 'object_id' => $attribute->attribute('contentobject_id'), 'priority' => $priority));
     $linkObject->store();
 }