Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-77069

Simplify the creation and working of Child theme

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.1
    • Themes
    • MOODLE_401_STABLE

      In situation where we only have to override core template, we have to create a child theme with all the settings and config from parent theme. This is very over complicated and is not the best use-case for child theme. Child theme should inherit the settings and styles from its parent unless its exclusively declared in the child theme. And child theme should be created with minimalist code.

      After viewing the working of Boost theme, I think we need some minor changes in /lib/outputlib.php to check if the settings is available in child theme otherwise inherit from its parent; also some minor change in /theme/boost/lib.php.

      Following are its benefit:

      1. Overriding any core template will simply need you to create a child theme with minimum config.php contents:

        require_once($CFG->dirroot . '/theme/boost/config.php');
        $THEME->parents = ['boost'];
        $THEME->name = 'mychild';

      2. No need to create entire settings.php, lib.php files for child theme
      3. If there is a need to override specific settings from parent then a specific setting can be created in a child theme settings.php file
      4. User can still use the settings from its parent theme settings page if its not declared in the child.
      5. No need to worry if there is an update in parent theme, as the settings can be automatically inherited.

      Once we adopt this in Boost theme, then it can be considered as a standard for all other theme contributors to make it developer-friendly for child themes.

            Unassigned Unassigned
            zishanj Zishan Javaid
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.