BUILDING FLEXIBLE PAGE-LAYOUTS WITH DS & PARAGRAPHS
Pieter Mathys - @mathysp - dazzle
No need to take pictures!
Just follow along here:
This presentation is for everyone!
Beginners, Experts, ...
We are hiring! - dazzle.be/jobs
We want Websites with
Complex Layouts
that are
Easy to use
Easy to maintain
Offer lots of flexibility
It's easy to...
... build complex layouts
... give the client lots of power
But combining those 2?
That spells trouble!
Build websites with
Layouts
to create our layout templates
Fields
to map functionality to a field
Create reusable "Content Blocks"
Content
Blocks
DS + Paragraphs
=
A strong tool to create advanced Page Layouts
with flexible, reusable Content Blocks
References a Node
Download from:
https://www.drupal.org/project/drupal
Or Drush:
drush dl drupal-8 --select
Great Guides:
Download from:
https://www.drupal.org/project/paragraphs
$ drush dl paragraphs
Enable:
admin/modules
$ drush en paragraphs
ds_content.field_header_image
Manage Display
<theme>.layouts.yml
<template>.html.twig
dz_1col_stacked:
label: 1 Col - Stacked
category: Dazzle
class: '\Drupal\ds\Plugin\DsLayout'
type: partial
template: templates/nodes/dz-1col-stacked
regions:
ds_header:
label: Header
ds_content:
label: Content
ds_footer:
label: Footer
<{{ ds_content_wrapper }}{{ attributes.addClass('dz-1col-stacked', 'clearfix') }}>
{{ title_suffix.contextual_links }}
{% if ds_header %}
<div class="header-wrapper" >
{{ ds_header }}
</div>
{% endif %}
{% if ds_content %}
<div class="content-wrapper">
{{ ds_content }}
</div>
{% endif %}
{% if ds_footer %}
<div class="footer-wrapper">
{{ ds_footer }}
</div>
{% endif %}
</{{ ds_content_wrapper }}>
+
drush cex sync
Now copy/paste!
dazzle_paragraphs.info.yml
dazzle_paragraphs.module
/config
/config/install
/config/optional
/config/install
/config/install
Issue Discussion
https://www.drupal.org/node/2461695
Patch by @trobert_
https://www.drupal.org/files/issues/paragraphs_localised-2461695.patch
And a big thank you to the awesome organisation of DrupalCamp Ghent!