SlideShare a Scribd company logo
http://bit.ly/2nXS6dI
Creating a child theme
for Boost
Richard Oelmann
‘Themer’, Teacher, Learning Technologist,
Moodle Developer
@oelmann_richard
http://bit.ly/2nXS6dI
Creating a child theme for Boost
https://www.slideshare.net/RichardOelmann/
moodle-moot-ieuk-2017-creating-a-child-theme-for-boost
http://bit.ly/2nXS6dI
http://bit.ly/2nXS6dI
What is Boost?
● New core and default theme in Moodle 3.2
● Improving navigation and UX
● Uses Mustache templating framework
● Built on Bootstrap 4
– SASS in place of LESS
– Bootstrap 4 is still in Alpha
– Enables ‘presets’
http://bit.ly/2nXS6dI
What is Boost?
Customising Boost the easy way–
● Changing branding, colours and
images
– Use presets
– Moodle.net preset
sharing
● http://bit.ly/2o6QBbc
http://bit.ly/2nXS6dI
Customising Boost the easy way–
● Changing branding, colours and
images
– Use presets
– Moodle.net preset
sharing
● http://bit.ly/2o6QBbc
http://bit.ly/2nXS6dI
Customising Boost the easy way–
● Boost settings
– SASS variables for consistency and ease
● Change it once, applied everywhere
– Custom SCSS to fine-tune a preset
http://bit.ly/2nXS6dI
Customising Boost the easy way–
If you don’t need to
change html
Don’t!
Presets Rock!
http://bit.ly/2nXS6dI
Basic changes: Child or clone
● Child themes - Recommended
– Inherits from the parent
– Upstream changes are reflected (can be pro/con!)
● Cloned themes
– Start identical to original
– Good base for own standalone developments
– Need to be maintained with any bug fixes from
upstream
http://bit.ly/2nXS6dI
Creating a Boost child -
Minimalist > Simple settings
● Some example child themes
– StageOne – very minimalist, no settings
● http://bit.ly/2nCLJg5
– StageTwo – minimalist, settings cloned from Boost
● http://bit.ly/2nCBYOY
– Photo – Moodle.org Boost child theme tutorial,
extends “simple” settings
● http://bit.ly/2nqg15l (Theme)
● http://bit.ly/2nkSmS4 (Tutorial)
http://bit.ly/2nXS6dI
Child theme structure
StageOne
Language file
Favicon
Screenshot image
config.php
lib.php
version.php
http://bit.ly/2nXS6dI
Creating a Boost child -
Adding First Settings
● Create the setting as normal
● http://bit.ly/2owiFVu
$name = ‘theme_stagetwo/brandcolor’;
$title = get_string(‘brandcolor’, ‘theme_stagetwo’);
$description = get_string(‘brandcolor_desc’, 
‘theme_stagetwo’);
$setting = new admin_setting_configcolourpicker($name, 
$title, $description, ‘’);
$setting­>set_updatedcallback(‘theme_reset_all_caches’);
$page­>add($setting);
http://bit.ly/2nXS6dI
Creating a Boost child -
Adding First Settings
● Changing a SASS variable?
● Add the variable to the lib function
$configurable array
– http://bit.ly/2okmyME
function theme_waxed_get_pre_scss($theme) {
global $CFG;
$precss = ‘’;
$configurable = [
    ‘brandprimary’ => [‘brand­primary’],
    ‘brandsuccess’ => [‘brand­success’],
    ‘brandwarning’ => [‘brand­warning’],
    ‘mysettingname’ => [‘my­scss­variable’],
];
http://bit.ly/2nXS6dI
Creating a Boost child -
Adding First Settings
● Other CSS/SASS settings
● Can be appended to prescss or extrascss
– http://bit.ly/2o6Eqvb
$headerbg = $theme ­ > setting_file_url(‘headerdefaultimage’, 
    ‘headerdefaultimage’);
if (isset($headerbg)) {
    $prescss .= ‘header#page­header .card {background­image:
        url(“’ . $headerbg . ’”); background­size:100%        
        100%)’;
}
http://bit.ly/2nXS6dI
Creating a Boost child -
Layouts and Templates
● Examples of more complex Boost
child themes:
– Waxed http://bit.ly/2nsMlRR
– Fordson http://bit.ly/2ooTQ0E
http://bit.ly/2nXS6dI
Creating a Boost child
http://bit.ly/2nXS6dI
Creating a Boost child -
Layouts and Templates
● Layout files call template files http://bit.ly/2n0BFyA
● Hold most logic and pass results
● Pass display items and variables in a context array
$templatecontext = [
    'sitename' => format_string($SITE­>shortname, true, ['context' 
=> context_course::instance(SITEID), "escape" => false]),
    'output' => $OUTPUT,
    'sidepreblocks' => $blockshtml,
    'hasblocks' => $hasblocks,
    'bodyattributes' => $bodyattributes,
    'navdraweropen' => $navdraweropen,
    'regionmainsettingsmenu' => $regionmainsettingsmenu,
    'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu)
];
echo $OUTPUT­>render_from_template('theme_waxed/columns2', 
$templatecontext);
http://bit.ly/2nXS6dI
Creating a Boost child -
Layouts and Templates
● Templates use a framework called
mustache
● Mustache docs
– http://bit.ly/2nKiqqb
● Limited logic, focus on producing clean
html output
http://bit.ly/2nXS6dI
Creating a Boost child -
Layouts and Templates
● New templates for things we haven’t had
renderers for before
– http://bit.ly/2n0LT1I
● Eg. login page now has a template
● Copy templates/core/login.mustache to your child
theme and edit
http://bit.ly/2nXS6dI
Creating a Boost child -
Layouts and Templates
● Main templates (eg column2.mustache) called
from layout files
– http://bit.ly/2op9iKO
● Many other templates called from functions
– eg. blocks
● http://bit.ly/2nw4mzq - Output function with context
● http://bit.ly/2opbfqs - template called
http://bit.ly/2nXS6dI
Creating a Boost child -
Index of links● Presets – Slide 3
– Moodle.net preset sharing http://bit.ly/2o6QBbc
● Theme Examples – Slide 7&12
– Stage One http://bit.ly/2nCLJg5
– Stage Two http://bit.ly/2nCBYOY
– Photo Theme http://bit.ly/2nqg15l
– Photo Tutorial http://bit.ly/2nkSmS4
– Waxed http://bit.ly/2nsMlRR
– Fordson http://bit.ly/2ooTQ0E
● Settings - Slide 9-11
– Settings example http://bit.ly/2owiFVu
– Variable Settings http://bit.ly/2ooQdb1
– Appending settings to scss http://bit.ly/2n0Gw2J
●
Layouts and Templates – Slide 13-15
– Template contexts http://bit.ly/2n0BFyA
– Mustache Docs http://bit.ly/2nKiqqb
– New core templates in Boost http://bit.ly/2n0LT1I
● Calling templates Slide 16
– Layout files http://bit.ly/2op9iKO
– Output class funtions example http://bit.ly/2nw4mzq
– Template example http://bit.ly/2opbfqs http://bit.ly/2nXS6dI

More Related Content

PPSX
Customization of the new Boost theme
KEY
Theme guru's (Moodle 2 Edition)
PPT
Introduction of drupal7 by ayushi infotech
ODP
Drupal 6x Installation
ODP
Buddypress Pasadena Meetup
PDF
Buddy Press 10-19-2012
PPT
Beginner's guide to drupal
PPTX
Advanced WordPress Optimization - iGaming Supershow 2012
Customization of the new Boost theme
Theme guru's (Moodle 2 Edition)
Introduction of drupal7 by ayushi infotech
Drupal 6x Installation
Buddypress Pasadena Meetup
Buddy Press 10-19-2012
Beginner's guide to drupal
Advanced WordPress Optimization - iGaming Supershow 2012

What's hot (8)

PPT
Drupal for Libraries 05/28/09
PPTX
Learn How to Use Atomic Design to Make Your Site Manageable and Adaptable
PPTX
Best Practices for Migrating a Legacy-Based CMS to Drupal
PPT
Fronteers - Drupal 7 ux
PPT
Introduction to drupal
PDF
Hello Drupal!
PPTX
In-Fisherman.com - Building an Enterprise Level Drupal Site
PPTX
WordPress & Expired Domains: How To Do It Right!
Drupal for Libraries 05/28/09
Learn How to Use Atomic Design to Make Your Site Manageable and Adaptable
Best Practices for Migrating a Legacy-Based CMS to Drupal
Fronteers - Drupal 7 ux
Introduction to drupal
Hello Drupal!
In-Fisherman.com - Building an Enterprise Level Drupal Site
WordPress & Expired Domains: How To Do It Right!
Ad

Similar to Moodle Moot IE/UK 2017 Creating a child theme for Boost (20)

PPT
2009-08-28-WordPress-Parent-Child-Themes
PDF
Cool Tools that make front-end development fun!
PDF
CustomThesis
PDF
CustomThesis
PPT
Introduction to WordPress & Theme Development
PDF
Developing a Web Application
PPTX
EdTechJoker Spring 2020 - Lecture 4 - HTML
PDF
HTML CSS Best Practices
PPTX
Technology Tips for Administrators
PPTX
HTML5 and CSS3 Techniques You Can Use Today
PPTX
HTML/CSS for WordPress
PPTX
46h interaction 1.lesson Hello world
PDF
Creating WordPress Theme Faster, Smarter & Without Swearing
PPTX
Front end performance optimization
PPT
PSD to a Drupal Theme (using a base theme)
PPTX
Drupal Camp Manila 2014 - Theming with Zen
PDF
Creating and Deploying Static Sites with Hugo
DOCX
Create An Online Course In Moodle 2010 Spring Conference
PPTX
Customizing WordPress Themes
PPTX
Workflow Essentials for Web Development
2009-08-28-WordPress-Parent-Child-Themes
Cool Tools that make front-end development fun!
CustomThesis
CustomThesis
Introduction to WordPress & Theme Development
Developing a Web Application
EdTechJoker Spring 2020 - Lecture 4 - HTML
HTML CSS Best Practices
Technology Tips for Administrators
HTML5 and CSS3 Techniques You Can Use Today
HTML/CSS for WordPress
46h interaction 1.lesson Hello world
Creating WordPress Theme Faster, Smarter & Without Swearing
Front end performance optimization
PSD to a Drupal Theme (using a base theme)
Drupal Camp Manila 2014 - Theming with Zen
Creating and Deploying Static Sites with Hugo
Create An Online Course In Moodle 2010 Spring Conference
Customizing WordPress Themes
Workflow Essentials for Web Development
Ad

More from Richard Oelmann (16)

PDF
MoodleMoot19 Electronic Management of Assessment
PDF
If This Then What
ODP
Strategic enhancement group presentation
PDF
Flipped classroom1
PDF
Developing innovative assessment
PDF
Learning Outcomes and Assessment - Achieving Constructive Alignment Treforest...
PDF
Hea fellow app
PDF
Assessment and feedback lecture
PPTX
Effective feedback-RO-treforest
PDF
Assessment for learning policy ro
PPTX
Effective feedback ro
PPTX
Achieving constructive alignment
PPTX
Developing innovative assessment
PPTX
Moodle moot15 presentation richardoelmann
PPTX
Moodle moot15 presentation richardoelmann
PPTX
Moodle moot15 presentation richardoelmann
MoodleMoot19 Electronic Management of Assessment
If This Then What
Strategic enhancement group presentation
Flipped classroom1
Developing innovative assessment
Learning Outcomes and Assessment - Achieving Constructive Alignment Treforest...
Hea fellow app
Assessment and feedback lecture
Effective feedback-RO-treforest
Assessment for learning policy ro
Effective feedback ro
Achieving constructive alignment
Developing innovative assessment
Moodle moot15 presentation richardoelmann
Moodle moot15 presentation richardoelmann
Moodle moot15 presentation richardoelmann

Recently uploaded (20)

PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Pharma ospi slides which help in ospi learning
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Complications of Minimal Access Surgery at WLH
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PPTX
Cell Types and Its function , kingdom of life
PPTX
Cell Structure & Organelles in detailed.
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Supply Chain Operations Speaking Notes -ICLT Program
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
2.FourierTransform-ShortQuestionswithAnswers.pdf
Pharma ospi slides which help in ospi learning
FourierSeries-QuestionsWithAnswers(Part-A).pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
O7-L3 Supply Chain Operations - ICLT Program
Anesthesia in Laparoscopic Surgery in India
Complications of Minimal Access Surgery at WLH
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Cell Types and Its function , kingdom of life
Cell Structure & Organelles in detailed.
STATICS OF THE RIGID BODIES Hibbelers.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx

Moodle Moot IE/UK 2017 Creating a child theme for Boost

  • 1. http://bit.ly/2nXS6dI Creating a child theme for Boost Richard Oelmann ‘Themer’, Teacher, Learning Technologist, Moodle Developer @oelmann_richard
  • 2. http://bit.ly/2nXS6dI Creating a child theme for Boost https://www.slideshare.net/RichardOelmann/ moodle-moot-ieuk-2017-creating-a-child-theme-for-boost http://bit.ly/2nXS6dI
  • 3. http://bit.ly/2nXS6dI What is Boost? ● New core and default theme in Moodle 3.2 ● Improving navigation and UX ● Uses Mustache templating framework ● Built on Bootstrap 4 – SASS in place of LESS – Bootstrap 4 is still in Alpha – Enables ‘presets’
  • 5. Customising Boost the easy way– ● Changing branding, colours and images – Use presets – Moodle.net preset sharing ● http://bit.ly/2o6QBbc http://bit.ly/2nXS6dI
  • 6. Customising Boost the easy way– ● Changing branding, colours and images – Use presets – Moodle.net preset sharing ● http://bit.ly/2o6QBbc http://bit.ly/2nXS6dI
  • 7. Customising Boost the easy way– ● Boost settings – SASS variables for consistency and ease ● Change it once, applied everywhere – Custom SCSS to fine-tune a preset http://bit.ly/2nXS6dI
  • 8. Customising Boost the easy way– If you don’t need to change html Don’t! Presets Rock! http://bit.ly/2nXS6dI
  • 9. Basic changes: Child or clone ● Child themes - Recommended – Inherits from the parent – Upstream changes are reflected (can be pro/con!) ● Cloned themes – Start identical to original – Good base for own standalone developments – Need to be maintained with any bug fixes from upstream http://bit.ly/2nXS6dI
  • 10. Creating a Boost child - Minimalist > Simple settings ● Some example child themes – StageOne – very minimalist, no settings ● http://bit.ly/2nCLJg5 – StageTwo – minimalist, settings cloned from Boost ● http://bit.ly/2nCBYOY – Photo – Moodle.org Boost child theme tutorial, extends “simple” settings ● http://bit.ly/2nqg15l (Theme) ● http://bit.ly/2nkSmS4 (Tutorial) http://bit.ly/2nXS6dI
  • 11. Child theme structure StageOne Language file Favicon Screenshot image config.php lib.php version.php http://bit.ly/2nXS6dI
  • 12. Creating a Boost child - Adding First Settings ● Create the setting as normal ● http://bit.ly/2owiFVu $name = ‘theme_stagetwo/brandcolor’; $title = get_string(‘brandcolor’, ‘theme_stagetwo’); $description = get_string(‘brandcolor_desc’,  ‘theme_stagetwo’); $setting = new admin_setting_configcolourpicker($name,  $title, $description, ‘’); $setting­>set_updatedcallback(‘theme_reset_all_caches’); $page­>add($setting); http://bit.ly/2nXS6dI
  • 13. Creating a Boost child - Adding First Settings ● Changing a SASS variable? ● Add the variable to the lib function $configurable array – http://bit.ly/2okmyME function theme_waxed_get_pre_scss($theme) { global $CFG; $precss = ‘’; $configurable = [     ‘brandprimary’ => [‘brand­primary’],     ‘brandsuccess’ => [‘brand­success’],     ‘brandwarning’ => [‘brand­warning’],     ‘mysettingname’ => [‘my­scss­variable’], ]; http://bit.ly/2nXS6dI
  • 14. Creating a Boost child - Adding First Settings ● Other CSS/SASS settings ● Can be appended to prescss or extrascss – http://bit.ly/2o6Eqvb $headerbg = $theme ­ > setting_file_url(‘headerdefaultimage’,      ‘headerdefaultimage’); if (isset($headerbg)) {     $prescss .= ‘header#page­header .card {background­image:         url(“’ . $headerbg . ’”); background­size:100%                 100%)’; } http://bit.ly/2nXS6dI
  • 15. Creating a Boost child - Layouts and Templates ● Examples of more complex Boost child themes: – Waxed http://bit.ly/2nsMlRR – Fordson http://bit.ly/2ooTQ0E http://bit.ly/2nXS6dI
  • 16. Creating a Boost child http://bit.ly/2nXS6dI
  • 17. Creating a Boost child - Layouts and Templates ● Layout files call template files http://bit.ly/2n0BFyA ● Hold most logic and pass results ● Pass display items and variables in a context array $templatecontext = [     'sitename' => format_string($SITE­>shortname, true, ['context'  => context_course::instance(SITEID), "escape" => false]),     'output' => $OUTPUT,     'sidepreblocks' => $blockshtml,     'hasblocks' => $hasblocks,     'bodyattributes' => $bodyattributes,     'navdraweropen' => $navdraweropen,     'regionmainsettingsmenu' => $regionmainsettingsmenu,     'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu) ]; echo $OUTPUT­>render_from_template('theme_waxed/columns2',  $templatecontext); http://bit.ly/2nXS6dI
  • 18. Creating a Boost child - Layouts and Templates ● Templates use a framework called mustache ● Mustache docs – http://bit.ly/2nKiqqb ● Limited logic, focus on producing clean html output http://bit.ly/2nXS6dI
  • 19. Creating a Boost child - Layouts and Templates ● New templates for things we haven’t had renderers for before – http://bit.ly/2n0LT1I ● Eg. login page now has a template ● Copy templates/core/login.mustache to your child theme and edit http://bit.ly/2nXS6dI
  • 20. Creating a Boost child - Layouts and Templates ● Main templates (eg column2.mustache) called from layout files – http://bit.ly/2op9iKO ● Many other templates called from functions – eg. blocks ● http://bit.ly/2nw4mzq - Output function with context ● http://bit.ly/2opbfqs - template called http://bit.ly/2nXS6dI
  • 21. Creating a Boost child - Index of links● Presets – Slide 3 – Moodle.net preset sharing http://bit.ly/2o6QBbc ● Theme Examples – Slide 7&12 – Stage One http://bit.ly/2nCLJg5 – Stage Two http://bit.ly/2nCBYOY – Photo Theme http://bit.ly/2nqg15l – Photo Tutorial http://bit.ly/2nkSmS4 – Waxed http://bit.ly/2nsMlRR – Fordson http://bit.ly/2ooTQ0E ● Settings - Slide 9-11 – Settings example http://bit.ly/2owiFVu – Variable Settings http://bit.ly/2ooQdb1 – Appending settings to scss http://bit.ly/2n0Gw2J ● Layouts and Templates – Slide 13-15 – Template contexts http://bit.ly/2n0BFyA – Mustache Docs http://bit.ly/2nKiqqb – New core templates in Boost http://bit.ly/2n0LT1I ● Calling templates Slide 16 – Layout files http://bit.ly/2op9iKO – Output class funtions example http://bit.ly/2nw4mzq – Template example http://bit.ly/2opbfqs http://bit.ly/2nXS6dI