本文整理汇总了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;
}