SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Downloaden Sie, um offline zu lesen
CROWDCommunications Group, LLC
CROWDCommunications Group, LLC
Drupal 8 Theming
Exploring Twig & Other Frontend Changes
About Me
Sean T.Walsh
sean@crowdcg.com
@seantwalsh
@crowdcg
irc: crowdcg
Agenda
• What is Twig & Why is it in D8
• Improving the Themer Experience
• Getting Involved
• Questions
Twig & D8
A New Template Engine
Drupal 7 = PHPTemplate
• Conflict between 

Back-end & Front-end
• Potential Security Issues
• 55 templates

154 functions
Drupal 8 = Twig
• Keeps Back-end & Front-
end Separated
• More Secure -
Autoescaping
• 149 templates

21 functions
Crash Course
Comments & Vars
PHP Twig
<?php
// My test variable
print $variable;
{# My test variable #}
{{ variable }}
Set Variables
{% set variable = 'result' %}
{%
set array = [
'foo',
'bar',
]
%}
Arrays
PHP
Twig
<?php
print $foo[‘bar’][‘und']->content['baz']['foo']['bar'];
?>
{{ foo.bar.content.baz.foo.bar }}
Finding Stuff in Twig
Print all available variables
Print content of specic variable
{{ dump() }}
{{ dump(foo) }}
Loops
<h2>Organizers</h2>
<ul>
{% for user in users %}
<li>{{ user.username}}</li>
{% endfor %}
</ul>
<h2>Organizers</h2>
<ul>
<li>David</li>
<li>Peter</li>
<li>Sean</li>
</ul>
Loops (Cont.)
{{ loop.length }}
{{ loop.rst }}
{{ loop.last }}
{{ loop.index }}
{% if loop.rst %}
...
{% elseif loop.index == 2 %}
...
{% elseif loop.last %}
...
{% endif %}
Loop with Empty Text
<h2>Organizers</h2>
<ul>
{% for user in users %}
<li>{{ user.username}}</li>
{% else %}
<li>no results found</li>
{% endfor %}
</ul>
Filter
<p>
{% lter upper %}
uppercase for the win
{% endlter %}
</p>
|Filter
{% set name = 'Sean' %}
<span>
{{ name|length }}
</span>
<span>
4
</span>
Filters Reference
• abs
• batch
• capitalize
• convert_encoding
• date
• date_modify
• default
• escape
• first
• format
• join
• json_encode
• keys
• last
• length
• lower
• merge
• nl2br
• number_format
• raw
• replace
• reverse
• round
• slice
• sort
• split
• striptags
• title
• trim
• upper
• url_encode
Twig Blocks
page.html.twig
page--front.html.twig
{% block headerblock %}
<h2>DrupalCamp NJ</h2>
{% endblock %}
{% extends "page.html.twig" %}
{% block headerblock %}
{{ parent() }}
<h4>Fourth Annual</h4>
{% endblock %}
Other Drupal 8 

Theme Changes
HTML5 + CSS3
Good Riddance
IE6 

(<1%)
IE7

(<1%)
IE8

(~10%)
CSS Built on 

SMACSS & BEM
CSS


HTML
.eld {
margin: 20px 15px;
}
.field.field—name {
color: orange;
}
<div class=“field field--name”>DCNJ</div>
Extra Bits
• Themes in /themes folder

no more /sites/all/themes/…
• Templates are auto-loaded with hook_theme
implementation key!
• Drupal 8 Theme Layer
theme.info.yml
• Formerly theme.info (same data)
• No more stylesheets or scripts properties

(still have stylesheets-override & stylesheets-remove)
• Need to define CSS & JS in *.libraries.yml
why-slider:
version: 1.x
css:
theme:
css/why-slider.css: {}
js:
js/why-slider.js: {}
dependencies:
- core/jquery
Twig FTW!
Drupal Specic Functionality
Filters
{% set class_name = 'dcnj/2015' %}
{%
set organizers = [
'davidhernandez',
'pwolanin',
]
%}
{{ class_name|clean_class }}
{{ organizers|without('pwolanin') }},
{{ attendees|placeholder('you') }}
dcnj-2015
davidhernandez
you
Other Methods
addClass / removeClass
setAttribute / removeAttribute
<div{{ attributes.setAttribute('id', 'camp').setAttribute('I-Love', 'NJ') }}>
<div{{ attributes.removeAttribute('id') }}>
<div{{ attributes.addClass('eld-item-' ~ name|clean_class) }}>
<div{{ attributes.removeClass('foo', 'bar').addClass('baz') }}>
Translate
or
{% trans %}
Author {{ username }}
{% endtrans %}
{{ 'Author: @username'| t({'@username':username}) }}
Twig Debug
<!-- THEME DEBUG -->
<!-- CALL: _theme('page') -->
<!-- FILE NAME SUGGESTIONS:
* page--front.html.twig
* page--node.html.twig
x page.html.twig
-->
<!-- BEGIN OUTPUT from 'core/themes/bartik/templates/page.html.twig' -->
Enable in /sites/default/services.yml
Improving the 

Themer Experience
CONSENSUS BANANA
Phase 1

Move classes from preprocess 

to templates
Phase 2

Move templates from Core 

to the new Classy base theme

Consensus Banana
Phase 1 Example
{%
set classes = [
'node',
'node--type-' ~ node.bundle|clean_class,
node.isPromoted() ? 'node--promoted',
node.isSticky() ? 'node--sticky',
not node.isPublished() ? 'node--unpublished',
view_mode ? 'node--view-mode-' ~ view_mode|clean_class,
'clearx',
]
%}
<article{{ attributes.addClass(classes) }}>
{{ content }}
</article>
node.html.twig
Phase 2 - Classy
Why Classy
Getting Involved
• FREE Mentoring & Collaboration Day

Sunday, Feb. 1 @ Tigerlabs
• Monthly Mentoring & Collaboration

Third Tuesday 7-9pm @ Tigerlabs
• IRC #drupal-twig #drupal-contribute
• Bi-weekly Twig Hangouts (alt. 7am/pm)

Next is Thursday, Feb. 12 @ 7pm
CROWDCommunications Group, LLC
CROWDCommunications Group, LLC
Questions?
Sean T. Walsh

sean@crowdcg.com
@seantwalsh @crowdcg
irc: crowdcg

Weitere ähnliche Inhalte

Andere mochten auch

Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon DublinCreating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon DublinSuzanne Dergacheva
 
Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Anne Tomasevich
 
Connected Health Reference Architecture
Connected Health Reference ArchitectureConnected Health Reference Architecture
Connected Health Reference ArchitectureWSO2
 
A Reference Architecture for ETL 2.0
A Reference Architecture for ETL 2.0 A Reference Architecture for ETL 2.0
A Reference Architecture for ETL 2.0 DataWorks Summit
 
Best Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop Professionals
Best Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop ProfessionalsBest Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop Professionals
Best Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop ProfessionalsCloudera, Inc.
 

Andere mochten auch (6)

Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon DublinCreating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
 
Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8
 
Connected Health Reference Architecture
Connected Health Reference ArchitectureConnected Health Reference Architecture
Connected Health Reference Architecture
 
A Reference Architecture for ETL 2.0
A Reference Architecture for ETL 2.0 A Reference Architecture for ETL 2.0
A Reference Architecture for ETL 2.0
 
What is personal connected health?
What is personal connected health?What is personal connected health?
What is personal connected health?
 
Best Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop Professionals
Best Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop ProfessionalsBest Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop Professionals
Best Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop Professionals
 

KĂźrzlich hochgeladen

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel AraĂşjo
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 

KĂźrzlich hochgeladen (20)

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

Drupal 8 Theming - Exploring Twig and Other Frontend Changes

  • 1. CROWDCommunications Group, LLC CROWDCommunications Group, LLC Drupal 8 Theming Exploring Twig & Other Frontend Changes
  • 3. Agenda • What is Twig & Why is it in D8 • Improving the Themer Experience • Getting Involved • Questions
  • 5. A New Template Engine Drupal 7 = PHPTemplate • Conflict between 
 Back-end & Front-end • Potential Security Issues • 55 templates
 154 functions Drupal 8 = Twig • Keeps Back-end & Front- end Separated • More Secure - Autoescaping • 149 templates
 21 functions
  • 7. Comments & Vars PHP Twig <?php // My test variable print $variable; {# My test variable #} {{ variable }}
  • 8. Set Variables {% set variable = 'result' %} {% set array = [ 'foo', 'bar', ] %}
  • 10. Finding Stuff in Twig Print all available variables Print content of specic variable {{ dump() }} {{ dump(foo) }}
  • 11. Loops <h2>Organizers</h2> <ul> {% for user in users %} <li>{{ user.username}}</li> {% endfor %} </ul> <h2>Organizers</h2> <ul> <li>David</li> <li>Peter</li> <li>Sean</li> </ul>
  • 12. Loops (Cont.) {{ loop.length }} {{ loop.rst }} {{ loop.last }} {{ loop.index }} {% if loop.rst %} ... {% elseif loop.index == 2 %} ... {% elseif loop.last %} ... {% endif %}
  • 13. Loop with Empty Text <h2>Organizers</h2> <ul> {% for user in users %} <li>{{ user.username}}</li> {% else %} <li>no results found</li> {% endfor %} </ul>
  • 14. Filter <p> {% lter upper %} uppercase for the win {% endlter %} </p>
  • 15. |Filter {% set name = 'Sean' %} <span> {{ name|length }} </span> <span> 4 </span>
  • 16. Filters Reference • abs • batch • capitalize • convert_encoding • date • date_modify • default • escape • rst • format • join • json_encode • keys • last • length • lower • merge • nl2br • number_format • raw • replace • reverse • round • slice • sort • split • striptags • title • trim • upper • url_encode
  • 17. Twig Blocks page.html.twig page--front.html.twig {% block headerblock %} <h2>DrupalCamp NJ</h2> {% endblock %} {% extends "page.html.twig" %} {% block headerblock %} {{ parent() }} <h4>Fourth Annual</h4> {% endblock %}
  • 18. Other Drupal 8 
 Theme Changes
  • 21. CSS Built on 
 SMACSS & BEM CSS 
 HTML .eld { margin: 20px 15px; } .eld.eld—name { color: orange; } <div class=“field eld--name”>DCNJ</div>
  • 22. Extra Bits • Themes in /themes folder
 no more /sites/all/themes/… • Templates are auto-loaded with hook_theme implementation key! • Drupal 8 Theme Layer
  • 23. theme.info.yml • Formerly theme.info (same data) • No more stylesheets or scripts properties
 (still have stylesheets-override & stylesheets-remove) • Need to dene CSS & JS in *.libraries.yml why-slider: version: 1.x css: theme: css/why-slider.css: {} js: js/why-slider.js: {} dependencies: - core/jquery
  • 25. Filters {% set class_name = 'dcnj/2015' %} {% set organizers = [ 'davidhernandez', 'pwolanin', ] %} {{ class_name|clean_class }} {{ organizers|without('pwolanin') }}, {{ attendees|placeholder('you') }} dcnj-2015 davidhernandez you
  • 26. Other Methods addClass / removeClass setAttribute / removeAttribute <div{{ attributes.setAttribute('id', 'camp').setAttribute('I-Love', 'NJ') }}> <div{{ attributes.removeAttribute('id') }}> <div{{ attributes.addClass('eld-item-' ~ name|clean_class) }}> <div{{ attributes.removeClass('foo', 'bar').addClass('baz') }}>
  • 27. Translate or {% trans %} Author {{ username }} {% endtrans %} {{ 'Author: @username'| t({'@username':username}) }}
  • 28. Twig Debug <!-- THEME DEBUG --> <!-- CALL: _theme('page') --> <!-- FILE NAME SUGGESTIONS: * page--front.html.twig * page--node.html.twig x page.html.twig --> <!-- BEGIN OUTPUT from 'core/themes/bartik/templates/page.html.twig' --> Enable in /sites/default/services.yml
  • 29. Improving the 
 Themer Experience CONSENSUS BANANA Phase 1
 Move classes from preprocess 
 to templates Phase 2
 Move templates from Core 
 to the new Classy base theme

  • 31. Phase 1 Example {% set classes = [ 'node', 'node--type-' ~ node.bundle|clean_class, node.isPromoted() ? 'node--promoted', node.isSticky() ? 'node--sticky', not node.isPublished() ? 'node--unpublished', view_mode ? 'node--view-mode-' ~ view_mode|clean_class, 'clearx', ] %} <article{{ attributes.addClass(classes) }}> {{ content }} </article> node.html.twig
  • 32. Phase 2 - Classy
  • 34. Getting Involved • FREE Mentoring & Collaboration Day
 Sunday, Feb. 1 @ Tigerlabs • Monthly Mentoring & Collaboration
 Third Tuesday 7-9pm @ Tigerlabs • IRC #drupal-twig #drupal-contribute • Bi-weekly Twig Hangouts (alt. 7am/pm)
 Next is Thursday, Feb. 12 @ 7pm
  • 35. CROWDCommunications Group, LLC CROWDCommunications Group, LLC Questions? Sean T. Walsh
 sean@crowdcg.com @seantwalsh @crowdcg irc: crowdcg