当前位置: 首页>>代码示例>>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;未经允许,请勿转载。