Style guides Drupal development workflows
I am Kalin ChernevWeb developer @EC
Interests: APIs, tooling and reusability
Bragging rights: 1st Drupal site in 2007
Ping me: @kalinchernev
Hello!
Agenda
◉ Style guides◉ 3 focus areas◉ Drupal building blocks◉ 3 steps to implement components◉ Layouts
Style guides: overall picture
◉ General-purpose standardization◉ Focus on re-usability of components◉ Useful in large projects◉ Live documentation of design principles◉ Fits well into the world of Agile
Additional resources on SG
◉ Google for John Albin, Drupal, style guides◉ Go to styleguides.io◉ Next Europa style guide (in progress)◉ Decoupling Drupal Without Losing Your Head
3 focus areas
Tools
Sass & LESS
Grunt || Gulp || npm
Bootstrap, MD, etc.
Bower
Drupal
…..
Methodologies
Agile, SCRUM, etc.
BEM
SMACSS
Atomic design
CSS & JS patterns
….
Environment
The team
Standardization
Acceptance
UX, accessibility
Continuous *
….
“
The reason I use Drupal today is the same reason why
I started with it a decade agoIt does really good job in
content and data modelling
Drupal 7 building blocks
What Define / Specify Alter / Configure View / Render
Element hook_element_info() hook_element_info_alter() theme_element()
Block hook_block_info() hook_block_configure() hook_block_view()
Field (Field API) hook_field_info() hook_field_settings_form() hook_field_prepare_view()
Field (DS) hook_ds_field_info() hook_ds_field_settings_form() Callback function
Entity hook_entity_info() Field API || Display suite hook_entity_view()
But wait! What about Drupal 8?
Different code, but same concepts.
Aim for universal content modelling!
Entities + Fields + View modules
Implementation strategy
1. Define: hook_field_formatter_info()2. Configure: hook_field_formatter_settings_form()3. View: hook_field_formatter_view()
Site building: enable the user to configure the number of nav items.
Development: Field Formatter API: a convenient layer on top of Field API.
Business: reusable Drupal tool to apply styling on secondary information.
Display suite: advantages
◉ Drupal 8 ready◉ View modules are in core◉ Block fields◉ Custom fields (maximum flexibility)◉ Data modelling is natural (Manage displays)
Miscellaneous
◉ Render arrays or theme functions◉ Custom formatters of simple settings in DS◉ Block or BEAN (entity)