Paragraph

Some extra's for paragraph components.

Better classes

The classes on paragraph has been changed to:

{%
  set classes = [
    'paragraph',
    'paragraph--' ~ paragraph.bundle|clean_class,
    view_mode ? 'paragraph--' ~ paragraph.bundle|clean_class ~ '--' ~ view_mode|clean_class,
  ]
%}

Which gives you the following classes:

.paragraph {}
.paragraph--cta {}
.cta--teaser {}

Extra functions

Create the possibility to have paragraph-type-specific preprocess functions.

So inside paragraph--cta.theme you could now have this function:

<?php

/**
 * Implements template_preprocess_hook().
 */
function compony_preprocess_paragraph__cta(&$variables, $hook) {
  // Do custom preprocessing here, 
  // only for CTA paragraphs. 
}

(Docs: Extending hooks yourself)

Specifications

Machine name

paragraph

Built upon

Perks

Responsive
Accessible

Building blocks

HTML

Stats

Public component
26 downloads
No open issue

Contributors