Create a theme setting to set the page layout width.
Config schema and default config
mantratheme/config/schema/mantratheme.schema.yml
mantratheme.settings:
type: theme_settings
label: 'Mantra settings'
mapping:
page_width:
type: string
label: Page width
mantratheme/config/install/mantratheme.settings.yml
page_width: medium
Settings form
Add a settings form to set the value and use it in the page template.
All you have to do is add a theme-settings.php file in your theme directory and use a special form alter.
Page template class
Set the variable in a preprocess hook.
mantratheme.theme
page.html.twig
layout.css
Topics