本文整理汇总了PHP中cm_info::get_custom_data方法的典型用法代码示例。如果您正苦于以下问题:PHP cm_info::get_custom_data方法的具体用法?PHP cm_info::get_custom_data怎么用?PHP cm_info::get_custom_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cm_info
的用法示例。
在下文中一共展示了cm_info::get_custom_data方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resource_cm_info_view
/**
* Called when viewing course page. Shows extra details after the link if
* enabled.
*
* @param cm_info $cm Course module information
*/
function resource_cm_info_view(cm_info $cm) {
$details = $cm->get_custom_data();
if ($details) {
$cm->set_after_link(' ' . html_writer::tag('span', $details,
array('class' => 'resourcelinkdetails')));
}
}
示例2: folder_cm_info_view
/**
* Overwrites the content in the course-module object with the folder files list
* if folder.display == FOLDER_DISPLAY_INLINE
*
* @param cm_info $cm
*/
function folder_cm_info_view(cm_info $cm)
{
global $PAGE;
if ($cm->uservisible && $cm->get_custom_data() && has_capability('mod/folder:view', $cm->context)) {
// Restore folder object from customdata.
// Note the field 'customdata' is not empty IF AND ONLY IF we display contens inline.
// Otherwise the content is default.
$folder = $cm->get_custom_data();
$folder->id = (int) $cm->instance;
$folder->course = (int) $cm->course;
$folder->display = FOLDER_DISPLAY_INLINE;
$folder->name = $cm->name;
if (empty($folder->intro)) {
$folder->intro = '';
}
if (empty($folder->introformat)) {
$folder->introformat = FORMAT_MOODLE;
}
// display folder
$renderer = $PAGE->get_renderer('mod_folder');
$cm->set_content($renderer->display_folder($folder));
}
}
示例3: get_type_from_modinfo_info
/**
* Obtains the forum type based on its 'info' object in modinfo (e.g. from
* $modinfo->instances['forumng'][1234]). Usually this comes from the
* custom data in the cm_info object.
*
* @param object $info Info object (either cm_info or something else)
* @return string Forum type
*/
private static function get_type_from_modinfo_info(cm_info $info)
{
if (isset($info->forumtype)) {
// Only set when using get_modinfo_special for shared activity modules.
return $info->forumtype;
}
return $info->get_custom_data()->type;
}