本文整理汇总了PHP中DataObjectInterface::i18n_singular_name方法的典型用法代码示例。如果您正苦于以下问题:PHP DataObjectInterface::i18n_singular_name方法的具体用法?PHP DataObjectInterface::i18n_singular_name怎么用?PHP DataObjectInterface::i18n_singular_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObjectInterface
的用法示例。
在下文中一共展示了DataObjectInterface::i18n_singular_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupExcel
/**
* Initialize a new {@link PHPExcel} object based on the provided
* {@link DataObjectInterface} interface.
* @param DataObjectInterface $do
* @return PHPExcel
*/
protected function setupExcel(DataObjectInterface $do)
{
// Try to get the current user
$member = Member::currentUser();
$creator = $member ? $member->getName() : '';
// Get information about the current Model Class
$singular = $do ? $do->i18n_singular_name() : '';
$plural = $do ? $do->i18n_plural_name() : '';
// Create the Spread sheet
$excel = new PHPExcel();
$excel->getProperties()->setCreator($creator)->setTitle(_t('firebrandhq.EXCELEXPORT', '{singular} export', 'Title for the spread sheet export', array('singular' => $singular)))->setDescription(_t('firebrandhq.EXCELEXPORT', 'List of {plural} exported out of a SilverStripe website', 'Description for the spread sheet export', array('pluralr' => $plural)));
// Give a name to the sheet
if ($plural) {
$excel->getActiveSheet()->setTitle($plural);
}
return $excel;
}