Default block layout

Configuring the default block layout

You can configure the default block layout for new courses via config.php, which can save you time if you want a similar block layout across all of your courses. To configure the default block layout for new courses, you can add one or more of the following lines (from config-dist.php) to config.php, setting the block names as required.

We recommend adding these configuration options at the bottom of the config.php file.

When configuring these files you will need to know the block names as they are stored in the database. You can find these names in the mdl_block table, or in the appropriate block directory in the code.

If the following variable is set, it will override all other variables listed here:

$CFG->defaultblocks_override = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';

The following variables define the settings for defined course formats. These variables override any settings defined in the course format's config file.

$CFG->defaultblocks_site = 'site_main_menu,course_list:course_summary,calendar_month'; $CFG->defaultblocks_social = 'participants,search_forums,calendar_month,calendar_upcoming,social_activities,recent_activity,course_list'; $CFG->defaultblocks_topics = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity'; $CFG->defaultblocks_weeks = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';

These blocks are used when no other default setting is found:

$CFG->defaultblocks = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';

For example, if you wished to configure courses using the Topics format to display the People and Tags blocks on the left, and Messages, Online users and Recent activity on the right, you would add the following line to your config.php file:

Here the colon separates the blocks appearing on the left and those appearing on the right.

Note that the Course administration and Navigation blocks cannot be configured here - these blocks will always be available where they appear in the default Totara installation.