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

get_pre_scss_code: Order of scss is wrong (missing array_reverse)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Deferred
    • Icon: Minor Minor
    • None
    • 4.1.2
    • Themes
    • MOODLE_401_STABLE
    • MDL-77687-401-get_pre_scss_code-wrong-order
    • Hide
      1. Create a Boost child theme called theme_boost_child with
        $THEME->parents=['boost']
      2. Ensure the lib.php of theme_boost_child contains an function theme_boost_child_get_pre_scss returning an empty string
      3. Ensure that theme_boost_child's config.php contains prescsscallback with value theme_boost_child_get_pre_scss
      4. Create a child theme of theme_boost_child called theme_boost_grandchild with $THEME->parents=['boost_child','boost']
      5. Ensure the lib.php of theme_boost_grandchild contains an function theme_boost_grandchild_get_pre_scss returning an empty string
      6. Ensure that theme_boost_grandchild's config.php contains prescsscallback with value theme_boost_grandchild_get_pre_scss
      7. Set Moodle's design to theme_boost_grandchild
      8. Enable theme designer mode
      9. Load a Moodle page
      10. Ensure that the theme.css contains the following:

      /** Pre-SCSS from theme_boost_get_extra_scss **/
      /** Pre-SCSS from theme_boost_child_get_extra_scss **/
      /** Pre-SCSS from theme_boost_grandchild_get_extra_scss **/

      Show
      Create a Boost child theme called theme_boost_child with $THEME->parents= ['boost'] Ensure the lib.php of theme_boost_child contains an function theme_boost_child_get_pre_scss returning an empty string Ensure that theme_boost_child's config.php contains prescsscallback with value theme_boost_child_get_pre_scss Create a child theme of theme_boost_child called theme_boost_grandchild with $THEME->parents= ['boost_child','boost'] Ensure the lib.php of theme_boost_grandchild  contains an function theme_boost_grandchild_get_pre_scss returning an empty string Ensure that theme_boost_grandchild's config.php contains prescsscallback with value theme_boost_grandchild_get_pre_scss Set Moodle's design to theme_boost_grandchild Enable theme designer mode Load a Moodle page Ensure that the theme.css contains the following: /** Pre-SCSS from theme_boost_get_extra_scss **/ /** Pre-SCSS from theme_boost_child_get_extra_scss **/ /** Pre-SCSS from theme_boost_grandchild_get_extra_scss **/

      Just like MDL-77657, get_pre_scss_code is also missing an array_reverse().

      In get_pre_scss_code (see https://github.com/moodle/moodle/blob/f3bf17cdfbee0377f5a09fcbbcce7c0367bbe58b/lib/outputlib.php#L1621-L1642), theme ancestry is mixed up, too.

      If there are three themes (boost, boost_child and boost_grandchild), each with its own method in prescsscallback, the resulting scss code in theme designer mode contains:

      /** Pre-SCSS from theme_boost_child_get_extra_scss **/
      /** Pre-SCSS from theme_boost_get_extra_scss **/
      /** Pre-SCSS from theme_boost_grandchild_get_extra_scss **/

      This should probably rather be:

      /** Pre-SCSS from theme_boost_get_extra_scss **/
      /** Pre-SCSS from theme_boost_child_get_extra_scss **/
      /** Pre-SCSS from theme_boost_grandchild_get_extra_scss **/

      The solution for this would probably be to change

              foreach ($this->parent_configs as $parent_config) {

      to

              foreach (array_reverse($this->parent_configs) as $parent_config) {

      .

            poggenpohlda Daniel Poggenpohl
            poggenpohlda Daniel Poggenpohl
            Glyn (Mathew) May Glyn (Mathew) May
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 minute
                1m

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