本文整理匯總了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']);
}
示例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;
}