當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ezpObject::setAlwaysAvailableLanguageID方法代碼示例

本文整理匯總了PHP中ezpObject::setAlwaysAvailableLanguageID方法的典型用法代碼示例。如果您正苦於以下問題:PHP ezpObject::setAlwaysAvailableLanguageID方法的具體用法?PHP ezpObject::setAlwaysAvailableLanguageID怎麽用?PHP ezpObject::setAlwaysAvailableLanguageID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ezpObject的用法示例。


在下文中一共展示了ezpObject::setAlwaysAvailableLanguageID方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testIssue13497

 /**
  * Test for regression #13497:
  * attribute operator throws a PHP fatal error on a node without parent in a displayable language
  *
  * Situation:
  *  - siteaccess with one language (fre-FR) and ShowUntranslatedObjects disabled
  *  - parent content node in another language (eng-GB) with always available disabled
  *  - content node in the siteaccess' language (fre-FR)
  *  - fetch this fre-FR node from anywhere, and call attribute() on it
  *
  * Result:
  *  - Fatal error: Call to a member function attribute() on a non-object in
  *    kernel/classes/ezcontentobjecttreenode.php on line 4225
  *
  * Explanation: the error actually comes from the can_remove_location attribute
  */
 public function testIssue13497()
 {
     $bkpLanguages = eZContentLanguage::prioritizedLanguageCodes();
     // Create a folder in english only
     $folder = new ezpObject("folder", 2, 14, 1, 'eng-GB');
     $folder->setAlwaysAvailableLanguageID(false);
     $folder->name = "Parent for " . __FUNCTION__;
     $folder->publish();
     $locale = eZLocale::instance('fre-FR');
     $translation = eZContentLanguage::addLanguage($locale->localeCode(), $locale->internationalLanguageName());
     // Create an article in french only, as a subitem of the previously created folder
     $article = new ezpObject("article", $folder->attribute('main_node_id'), 14, 1, 'fre-FR');
     $article->title = "Object for " . __FUNCTION__;
     $article->short_description = "Description of test for " . __FUNCTION__;
     $article->publish();
     $articleNodeID = $article->attribute('main_node_id');
     // INi changes: set language to french only, untranslatedobjects disabled
     ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'ContentObjectLocale', 'fre-FR');
     // ezpINIHelper::setINISetting( 'site.ini', 'RegionalSettings', 'SiteLanguageList', array( 'fre-FR' ) );
     eZContentLanguage::setPrioritizedLanguages(array('fre-FR'));
     ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'ShowUntranslatedObjects', 'disabled');
     eZContentLanguage::expireCache();
     // This should crash
     eZContentObjectTreeNode::fetch($articleNodeID)->attribute('can_remove_location');
     ezpINIHelper::restoreINISettings();
     // re-expire cache for further tests
     eZContentLanguage::setPrioritizedLanguages($bkpLanguages);
     $article->remove();
     $translation->removeThis();
     eZContentLanguage::expireCache();
     ezpINIHelper::restoreINISettings();
 }
開發者ID:schwabokaner,項目名稱:ezpublish-legacy,代碼行數:48,代碼來源:ezcontentobjecttreenode_regression.php


注:本文中的ezpObject::setAlwaysAvailableLanguageID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。