本文整理匯總了PHP中renderer_base::format_description方法的典型用法代碼示例。如果您正苦於以下問題:PHP renderer_base::format_description方法的具體用法?PHP renderer_base::format_description怎麽用?PHP renderer_base::format_description使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類renderer_base
的用法示例。
在下文中一共展示了renderer_base::format_description方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: export_for_template
/**
* Export context for use in mustache templates
*
* @see templatable::export_for_template()
* @param renderer_base $output
* @return array
*/
public function export_for_template(\renderer_base $output)
{
$data = array('id' => $this->id, 'permalink' => clean_param($this->permalink, PARAM_URL), 'datepublished' => $output->format_published_date($this->timestamp), 'link' => clean_param($this->link, PARAM_URL));
// If the item does not have a title, create one from the description.
$title = $this->title;
if (!$title) {
$title = strip_tags($this->description);
$title = \core_text::substr($title, 0, 20) . '...';
}
// Allow the renderer to format the title and description.
$data['title'] = $output->format_title($title);
$data['description'] = $this->showdescription ? $output->format_description($this->description) : null;
return $data;
}