Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292473

Create new SDC component for Umami (disclaimer)

$
0
0

Problem/Motivation

Single directory components (SDC) is a new way to theme Drupal. Instead of scattering related files around your theme, they're contained to one directory. The primary issue for SDC is at #3313520: Single directory components in core.

The Demo Umami team has decided that their theme can depend on an experimental module like SDC. This allows us to have the work in this ticket merged even when #3352256: [META] Move code from the experimental SDC module to core is not committed.

Disclaimer component

The disclaimer is a custom block type and content block that appears after the footer. It displays content from two text fields: disclaimer and copyright.

Screenshot of annotated Disclaimer and Copyright

As part of SDC's roadmap (see #3345922: Single Directory Components module roadmap: the path to beta and stable), we want to convert Umami components to use SDC. For this task I'm choosing the Disclaimer component, which includes markup and CSS.

This component is a good fit because: it is a simple introduction to creating a SDC that replaces nested CSS selectors with BEM syntax and preserves block field display configuration.

This component involves the following Twig templates, CSS, assets, and libraries:

  1. disclaimer.css
  2. disclaimer.twig
  3. block--bundle--disclaimer-block.html.twig

Testing instructions

  1. Set up site with Umami profile.
  2. View page and see that disclaimer and copyright are visible below footer.
  3. Inspect markup with twig debug enabled and verify that component is being used.
  4. Modify the disclaimer block settings and verify that the component works with the different settings, such as hiding the copyright, enabling the disclaimer field label, etc.

Viewing all articles
Browse latest Browse all 292473

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>