Top Banner
Style guides Drupal development workflows
34

Style guides in drupal development workflows

Apr 11, 2017

Download

Technology

Kalin Chernev
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Style guides in drupal development workflows

Style guidesDrupal development workflows

Page 2: Style guides in 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!

Page 3: Style guides in drupal development workflows

Agenda

◉ Style guides◉ 3 focus areas◉ Drupal building blocks◉ 3 steps to implement components◉ Layouts

Page 4: Style guides in drupal development workflows

The presentation is just a map

Page 5: Style guides in drupal development workflows

Style guidesAnswering your W* questions

1

Page 6: Style guides in drupal development workflows

Next Europa Style Guide

Page 7: Style guides in drupal development workflows

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

Page 8: Style guides in drupal development workflows

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

Page 9: Style guides in drupal development workflows

3 focus areasThings you have to know and manage all the time.

2

Page 10: Style guides in drupal development workflows

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 *

….

Page 11: Style guides in drupal development workflows
Page 12: Style guides in drupal development workflows

Drupal building blocksRefresher on few reasons why Drupal is so flexible

3

Page 13: Style guides in drupal development workflows

Drupal building blocks

◉ Block◉ Field◉ Entity◉ View modes◉ APIs (Form, Element, Render array, etc.)

Page 14: Style guides in drupal development workflows

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

Page 15: Style guides in drupal development workflows

How to put CSS styles nicely

Page 16: Style guides in drupal development workflows

3-step planImplementing web components in a Drupal-way

4

Page 17: Style guides in drupal development workflows

General workflow

Page 18: Style guides in drupal development workflows

Generalized Drupal workflow

Define(Specify)

View(Display)

Render(Configure)

Page 19: Style guides in drupal development workflows

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()

Page 20: Style guides in drupal development workflows

But wait! What about Drupal 8?

Different code, but same concepts.

Aim for universal content modelling!

Entities + Fields + View modules

Page 21: Style guides in drupal development workflows

Element built in a style guide

Page 22: Style guides in drupal development workflows

How does it look in the front-end

Page 23: Style guides in drupal development workflows

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.

Page 24: Style guides in drupal development workflows

How does it look in the admin panel

Page 25: Style guides in drupal development workflows

Component user settings in admin

Page 26: Style guides in drupal development workflows

Reusability FTW

Page 27: Style guides in drupal development workflows

LayoutsDrupal tools and the topic of modifiers

5

Page 28: Style guides in drupal development workflows

Managing layouts in Drupal

◉ Display suite◉ Views◉ Panels

Page 29: Style guides in drupal development workflows

Display suite: advantages

◉ Drupal 8 ready◉ View modules are in core◉ Block fields◉ Custom fields (maximum flexibility)◉ Data modelling is natural (Manage displays)

Page 30: Style guides in drupal development workflows

Display suite layouts

Page 31: Style guides in drupal development workflows

Layout settings via formatter

Page 32: Style guides in drupal development workflows

Layout settings via formatter

Page 33: Style guides in drupal development workflows

Miscellaneous

◉ Render arrays or theme functions◉ Custom formatters of simple settings in DS◉ Block or BEAN (entity)

Page 34: Style guides in drupal development workflows

Any questions?

Connect at: @kalinchernev

Thanks!