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


PHP SiteTree::fieldLabels方法代碼示例

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


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

示例1: testUpdateFieldLabels

 public function testUpdateFieldLabels()
 {
     // Add custom translation for testing
     i18n::get_translator('core')->getAdapter()->addTranslation(array('SiteTree.METATITLE' => 'TRANS-EN Meta Title'), 'en');
     $siteTree = new SiteTree();
     $labels = $siteTree->fieldLabels();
     $this->assertArrayHasKey('MetaTitle', $labels);
     $this->assertEquals('TRANS-EN Meta Title', $labels['MetaTitle']);
     // Set different locale, clear field label cache
     i18n::set_locale('de_DE');
     DataObject::reset();
     // Add custom translation for testing
     i18n::get_translator('core')->getAdapter()->addTranslation(array('SiteTree.METATITLE' => 'TRANS-DE Meta Title'), 'de_DE');
     $labels = $siteTree->fieldLabels();
     $this->assertEquals('TRANS-DE Meta Title', $labels['MetaTitle']);
 }
開發者ID:helpfulrobot,項目名稱:kinglozzer-metatitle,代碼行數:16,代碼來源:MetaTitleExtensionTest.php

示例2: fieldLabels

 /**
  * Field labels for display in tables.
  *
  * @param boolean $includerelations A boolean value to indicate if the labels returned include relation fields
  *
  * @return array
  *
  * @author Sebastian Diel <sdiel@pixeltricks.de>,
  *         Sascha Koehler <skoehler@pixeltricks.de>
  * @since 06.10.2014
  */
 public function fieldLabels($includerelations = true)
 {
     $fieldLabels = array_merge(parent::fieldLabels($includerelations), array('UseAsRootForMainNavigation' => _t('SilvercartPage.UseAsRootForMainNavigation')));
     $this->extend('updateFieldLabels', $fieldLabels);
     return $fieldLabels;
 }
開發者ID:silvercart,項目名稱:silvercart,代碼行數:17,代碼來源:SilvercartPage.php


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