本文整理匯總了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;
}