本文整理匯總了PHP中format_base::get_default_blocks方法的典型用法代碼示例。如果您正苦於以下問題:PHP format_base::get_default_blocks方法的具體用法?PHP format_base::get_default_blocks怎麽用?PHP format_base::get_default_blocks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類format_base
的用法示例。
在下文中一共展示了format_base::get_default_blocks方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_default_blocks
/**
* Returns the list of blocks to be automatically added for the newly created course
*
* This function checks the existence of the file config.php in the course format folder.
* If file exists and contains the code
* $format['defaultblocks'] = 'leftblock1,leftblock2:rightblock1,rightblock2';
* these blocks are used, otherwise parent function is called
*
* @return array of default blocks, must contain two keys BLOCK_POS_LEFT and BLOCK_POS_RIGHT
* each of values is an array of block names (for left and right side columns)
*/
public function get_default_blocks()
{
global $CFG;
$formatconfig = $CFG->dirroot . '/course/format/' . $this->format . '/config.php';
$format = array();
// initialize array in external file
if (is_readable($formatconfig)) {
include $formatconfig;
}
if (!empty($format['defaultblocks'])) {
return blocks_parse_default_blocks_list($format['defaultblocks']);
}
return parent::get_default_blocks();
}