SlideShare a Scribd company logo
Theming in Drupal 8
Getting started guide
Kirill Borzov
https://drupal.org/u/oresh
http://github.com/oresh
Contents:
1. Differences with D7
2. File structure
3. Twig
4. Theme functions
Difference with Drupal 7
Same theme registry, same hook_theme, but with twig
hook_process removed
Now HTML5 friendly
Adding scripts and styles in library
All theme functions are now twig templates
New theme hook suggestions: http://bit.ly/2jhjPpd
Difference with Drupal 7
No jQuery by default
Breakpoints and Responsive images module
Image styles: /admin/config/media/responsive-image-style
Defining Breakpoints in theme config
Theme settings and defaults change a bit.
SMACSS and BEM based structure
Drupal is now more responsive http://bit.ly/2kH6Yta
Difference with Drupal 7
or use Headless Drupal 8,
so you don’t care ;)
File structure
THEMENAME.info.yml *
What libraries to include and basic theme stuff
http://bit.ly/2kFnGN2
THEMENAME.libraries.yml *
What files to include
https://www.drupal.org/node/2216195
THEMENAME.theme
Where the preprocess and alter logic goes
http://bit.ly/2keNZsR
Twig
Demo!
http://bit.ly/theming-d8-demo
Working with Twig
Quick overview: http://bit.ly/2kFep3A
Twig naming convention: http://bit.ly/2kFtMwJ
Twig filters: http://bit.ly/2kFkPzB
in Drupal: http://bit.ly/2kFyR8a
Twig funtions: http://bit.ly/2kFk6yv
in Drupal: http://bit.ly/2kFk6yv
Attributes http://bit.ly/2kFueeA
Theme functions
Read about theme api and core templates here: http://bit.ly/2lmOrD8
About hook_theme here:
http://bit.ly/2lmZewZ
Twig naming convention:
http://bit.ly/2lna3zh
Pattern lab starter for D8
http://bit.ly/2koGnTT
Thank you!
& have a nice day!
the presentation is available here:
http://bit.ly/theming-d8

More Related Content

Similar to Theming in Drupal 8 (everything)

Fronteers - Drupal 7 ux
Fronteers   - Drupal 7 uxFronteers   - Drupal 7 ux
Fronteers - Drupal 7 ux
Bojhan
 
Top 20 mistakes you will make on your 1st Drupal project
Top 20 mistakes you will make on your 1st Drupal projectTop 20 mistakes you will make on your 1st Drupal project
Top 20 mistakes you will make on your 1st Drupal project
Iztok Smolic
 
Architecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal CampArchitecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal Camp
Dipen Chaudhary
 
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
Anne Tomasevich
 
Drupal 6 Overview
Drupal 6 OverviewDrupal 6 Overview
Drupal 6 Overview
Ryan Cross
 
Drupal Theming
Drupal Theming Drupal Theming
Drupal Theming
Aimee Maree Forsstrom
 
Drupal 8 introduction to theming
Drupal 8  introduction to themingDrupal 8  introduction to theming
Drupal 8 introduction to theming
Brahampal Singh
 
Drupal
DrupalDrupal
Drupal 8: frontend development
Drupal 8: frontend developmentDrupal 8: frontend development
Drupal 8: frontend development
sparkfabrik
 
Drupal Theming for Developers
Drupal Theming for DevelopersDrupal Theming for Developers
Drupal Theming for Developers
Ian Carnaghan
 
Drupal7 themeing changes and inheritence
Drupal7 themeing changes and inheritenceDrupal7 themeing changes and inheritence
Drupal7 themeing changes and inheritence
Aimee Maree Forsstrom
 
Twig in the Wild
Twig in the WildTwig in the Wild
Twig in the Wild
JeremyKoulish
 
Converting (X)HTML/CSS template to Drupal 7 Theme
Converting (X)HTML/CSS template to Drupal 7 ThemeConverting (X)HTML/CSS template to Drupal 7 Theme
Converting (X)HTML/CSS template to Drupal 7 Theme
Adolfo Nasol
 
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
Eric Sembrat
 
The Drupal 7 Worst Practices Catalogue
The Drupal 7 Worst Practices CatalogueThe Drupal 7 Worst Practices Catalogue
The Drupal 7 Worst Practices Catalogue
Alexandre Israël
 
Your first d8 module
Your first d8 moduleYour first d8 module
Your first d8 module
tedbow
 
Drupal 8: Most common beginner mistakes
Drupal 8: Most common beginner mistakesDrupal 8: Most common beginner mistakes
Drupal 8: Most common beginner mistakes
Iztok Smolic
 
Drupal
DrupalDrupal
Drupal
tnhomestead
 
Drupal Now! - Introduction to Drupal
Drupal Now! - Introduction to DrupalDrupal Now! - Introduction to Drupal
Drupal Now! - Introduction to Drupal
Alozie Nwosu
 
Everything You Need to Know About the Top Changes in Drupal 8
Everything You Need to Know About the Top Changes in Drupal 8Everything You Need to Know About the Top Changes in Drupal 8
Everything You Need to Know About the Top Changes in Drupal 8
Acquia
 

Similar to Theming in Drupal 8 (everything) (20)

Fronteers - Drupal 7 ux
Fronteers   - Drupal 7 uxFronteers   - Drupal 7 ux
Fronteers - Drupal 7 ux
 
Top 20 mistakes you will make on your 1st Drupal project
Top 20 mistakes you will make on your 1st Drupal projectTop 20 mistakes you will make on your 1st Drupal project
Top 20 mistakes you will make on your 1st Drupal project
 
Architecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal CampArchitecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal Camp
 
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
 
Drupal 6 Overview
Drupal 6 OverviewDrupal 6 Overview
Drupal 6 Overview
 
Drupal Theming
Drupal Theming Drupal Theming
Drupal Theming
 
Drupal 8 introduction to theming
Drupal 8  introduction to themingDrupal 8  introduction to theming
Drupal 8 introduction to theming
 
Drupal
DrupalDrupal
Drupal
 
Drupal 8: frontend development
Drupal 8: frontend developmentDrupal 8: frontend development
Drupal 8: frontend development
 
Drupal Theming for Developers
Drupal Theming for DevelopersDrupal Theming for Developers
Drupal Theming for Developers
 
Drupal7 themeing changes and inheritence
Drupal7 themeing changes and inheritenceDrupal7 themeing changes and inheritence
Drupal7 themeing changes and inheritence
 
Twig in the Wild
Twig in the WildTwig in the Wild
Twig in the Wild
 
Converting (X)HTML/CSS template to Drupal 7 Theme
Converting (X)HTML/CSS template to Drupal 7 ThemeConverting (X)HTML/CSS template to Drupal 7 Theme
Converting (X)HTML/CSS template to Drupal 7 Theme
 
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
 
The Drupal 7 Worst Practices Catalogue
The Drupal 7 Worst Practices CatalogueThe Drupal 7 Worst Practices Catalogue
The Drupal 7 Worst Practices Catalogue
 
Your first d8 module
Your first d8 moduleYour first d8 module
Your first d8 module
 
Drupal 8: Most common beginner mistakes
Drupal 8: Most common beginner mistakesDrupal 8: Most common beginner mistakes
Drupal 8: Most common beginner mistakes
 
Drupal
DrupalDrupal
Drupal
 
Drupal Now! - Introduction to Drupal
Drupal Now! - Introduction to DrupalDrupal Now! - Introduction to Drupal
Drupal Now! - Introduction to Drupal
 
Everything You Need to Know About the Top Changes in Drupal 8
Everything You Need to Know About the Top Changes in Drupal 8Everything You Need to Know About the Top Changes in Drupal 8
Everything You Need to Know About the Top Changes in Drupal 8
 

More from Kirill Borzov

Учимся Руководить
Учимся РуководитьУчимся Руководить
Учимся Руководить
Kirill Borzov
 
UX for Busy People
UX for Busy PeopleUX for Busy People
UX for Busy People
Kirill Borzov
 
Lets talk about JavaScript (at JSMD Meetup #7)
Lets talk about JavaScript (at JSMD Meetup #7)Lets talk about JavaScript (at JSMD Meetup #7)
Lets talk about JavaScript (at JSMD Meetup #7)
Kirill Borzov
 
Timber Wordpress presentation
Timber Wordpress presentationTimber Wordpress presentation
Timber Wordpress presentation
Kirill Borzov
 
Panels: how to fire Front-end developer
Panels: how to fire  Front-end developerPanels: how to fire  Front-end developer
Panels: how to fire Front-end developer
Kirill Borzov
 
Drupal 7 — Circle theme
Drupal 7 — Circle themeDrupal 7 — Circle theme
Drupal 7 — Circle theme
Kirill Borzov
 
RailsGirls Mixbook presentation
RailsGirls Mixbook presentationRailsGirls Mixbook presentation
RailsGirls Mixbook presentation
Kirill Borzov
 
Рекрутинг.Js
Рекрутинг.JsРекрутинг.Js
Рекрутинг.Js
Kirill Borzov
 
Drupal 8 theming principles
Drupal 8 theming principlesDrupal 8 theming principles
Drupal 8 theming principles
Kirill Borzov
 
Mobile and web optimization + Drupal
Mobile and web optimization + DrupalMobile and web optimization + Drupal
Mobile and web optimization + Drupal
Kirill Borzov
 

More from Kirill Borzov (10)

Учимся Руководить
Учимся РуководитьУчимся Руководить
Учимся Руководить
 
UX for Busy People
UX for Busy PeopleUX for Busy People
UX for Busy People
 
Lets talk about JavaScript (at JSMD Meetup #7)
Lets talk about JavaScript (at JSMD Meetup #7)Lets talk about JavaScript (at JSMD Meetup #7)
Lets talk about JavaScript (at JSMD Meetup #7)
 
Timber Wordpress presentation
Timber Wordpress presentationTimber Wordpress presentation
Timber Wordpress presentation
 
Panels: how to fire Front-end developer
Panels: how to fire  Front-end developerPanels: how to fire  Front-end developer
Panels: how to fire Front-end developer
 
Drupal 7 — Circle theme
Drupal 7 — Circle themeDrupal 7 — Circle theme
Drupal 7 — Circle theme
 
RailsGirls Mixbook presentation
RailsGirls Mixbook presentationRailsGirls Mixbook presentation
RailsGirls Mixbook presentation
 
Рекрутинг.Js
Рекрутинг.JsРекрутинг.Js
Рекрутинг.Js
 
Drupal 8 theming principles
Drupal 8 theming principlesDrupal 8 theming principles
Drupal 8 theming principles
 
Mobile and web optimization + Drupal
Mobile and web optimization + DrupalMobile and web optimization + Drupal
Mobile and web optimization + Drupal
 

Recently uploaded

20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Zilliz
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
Pixlogix Infotech
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 

Recently uploaded (20)

20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 

Theming in Drupal 8 (everything)

  • 1. Theming in Drupal 8 Getting started guide
  • 3. Contents: 1. Differences with D7 2. File structure 3. Twig 4. Theme functions
  • 4. Difference with Drupal 7 Same theme registry, same hook_theme, but with twig hook_process removed Now HTML5 friendly Adding scripts and styles in library All theme functions are now twig templates New theme hook suggestions: http://bit.ly/2jhjPpd
  • 5. Difference with Drupal 7 No jQuery by default Breakpoints and Responsive images module Image styles: /admin/config/media/responsive-image-style Defining Breakpoints in theme config Theme settings and defaults change a bit. SMACSS and BEM based structure Drupal is now more responsive http://bit.ly/2kH6Yta
  • 6. Difference with Drupal 7 or use Headless Drupal 8, so you don’t care ;)
  • 7. File structure THEMENAME.info.yml * What libraries to include and basic theme stuff http://bit.ly/2kFnGN2 THEMENAME.libraries.yml * What files to include https://www.drupal.org/node/2216195 THEMENAME.theme Where the preprocess and alter logic goes http://bit.ly/2keNZsR
  • 9. Working with Twig Quick overview: http://bit.ly/2kFep3A Twig naming convention: http://bit.ly/2kFtMwJ Twig filters: http://bit.ly/2kFkPzB in Drupal: http://bit.ly/2kFyR8a Twig funtions: http://bit.ly/2kFk6yv in Drupal: http://bit.ly/2kFk6yv Attributes http://bit.ly/2kFueeA
  • 10. Theme functions Read about theme api and core templates here: http://bit.ly/2lmOrD8 About hook_theme here: http://bit.ly/2lmZewZ Twig naming convention: http://bit.ly/2lna3zh Pattern lab starter for D8 http://bit.ly/2koGnTT
  • 11. Thank you! & have a nice day! the presentation is available here: http://bit.ly/theming-d8

Editor's Notes

  1. Различия с Друпал седьмым, что добавилось, что исчезло Поговорим о всех возможных (адекватных) файлах в папке темы, и где она должна быть Поговорим о твиге, что дает, как использовать и разберем пару примеров Посмотрим как изменились theme функции и как их использовать в D8 Полезные ссылки: https://sqndr.github.io/d8-theming-guide/core-themes/index.html https://dl.dropboxusercontent.com/u/8325927/d8-theming-html/index.html https://www.drupal.org/list-changes/drupal/published?keywords_description=&to_branch=&version=&created_op=%3E%3D&created%5Bvalue%5D=&created%5Bmin%5D=&created%5Bmax%5D=&impacts%5B%5D=3
  2. В принципе больших изменений в создании темы для D8 от d7 нет. Конечно новый yml формат и twig, но это небольшие изменения. Размерем тонкости. — Такой же theme registry. Все объявленные theme функции попадают туда, как и препроцессы и расположение файла — объявление и использование hook_theme такое же, но не нужно объявлять темплейты. Сразу идут твиг темплейты. Определяется так же - наличие в теме, в модуле и в коре. Работает переписывание по названию файла — Раньше были preprocess и process, сейчас process выкинули — Друпал теперь во всю использует html5 элементы, role и rDFA генерит schema.org markup. Не все новые html5 тэги добавлены. Сюда же - css стал чище, убрали лишние классы, убрали лишние врапперы, html стал много красивее — Раньше стили и скрипты можно было добавлять откуда угодно (я писал статью об этом). Теперь это на плечах библиотек, и все разделено по компонентам. В .info.yml можно указать какие libraries использовать на всех страницах, какие переписать, дополнить или отменить. Библиотеки можно подключать в twig файле через {{ attach_library('fluffiness/cuddly-slider') }} Можно в theme_preprocess_hook через variables['#attached']['library'][] — Все коровские тимизационные функции переведены в twig Темплейты поменяли в twig расширения Функции без темплейтов перевели в темплейты В коре теперь нет html кода вне twig файлов — theme hook suggestion раньше был в preprocess’е, теперь для него сделали отдельный hook: hook_theme_suggestions_alter(array &$suggestions, array $variables, $hook) и hook_theme_hook_suggestion_HOOK_alter(array &$suggestions, array $variables). Добавляется строка с саджестом в $suggestions, с __. В названии темплейта должны быть - — рекомендуется из preprocess’ов убирать theme() и drupal_render() функции, а вместо этого создавать renderable array и указанием нужной темы. array(‘#theme’ => ‘menu-item’, ...);
  3. — Раньше jQuery был изначально на всех страницах, теперь его нужно подключать везде где нужно. Можно подключить глобально в theme.libraries.yml — модуль breakpoints в коре. Брейкпойнты задаются в yml файле THEMENAME.breakpoints.yml - Заданные брэйкпойнты можно использовать в модуль Responsive images. — Настройки темы можно задать в themename.theme или в theme-settings.php. Внутри должна быть функция function hook_form_system_theme_settings_alter() - дефолтные значения хранятся в настройках в теме: config/install/THEMENAME.settings.yml - переменные из настроек нужно отправлять в темплейт через препроцесс. Получить можно через theme_get_setting('foo_example'); — — Много всего, админка и тулбар сразу респонсив, брэйкпойнты, modernizr и прочее. Читать тут : https://www.drupal.org/node/1388492 — Друпал теперь НАКОНЕЦ поддерживает новую версию jquery (2.x), модернайзер и проч. Опять же, если нужны — подключить в library. — Появились тема classy - с минимальными классами и чистыми темплейтами. И тема stable - совсем голая. Лучше использовать тему Classy как base тему
  4. Если вы используете d8 как REST-full или API сервис, то в принципе вы не столкнетесь с проблемой верстки под d8 :)
  5. Демо: Слайды от Wes Ruvalcaba: http://wesruv.github.io/reveal.js/d8.html#/17 Template helper для Chrome: https://chrome.google.com/webstore/detail/drupal-template-helper/ppiceaegogijpjodfpiimifhbnaifbnn