~/talk

Preprocessing Paragraphs: A Beginner's Guide

Talkat MidCamp 2019 · 2019-03-21..03-24· [php]
links:none on file
slides:none on file

A practical four-step recipe for Drupal 8 paragraph preprocessing: hook_theme to declare paragraph types, a dedicated preprocessor class with per-paragraph methods, register it as a service in services.yml, and call template_preprocess_paragraph to return render arrays wired to paragraph Twig templates. Covers loading nested entity references, creating custom render arrays instead of view modes, and debugging with Twig var-dump and Symfony VarDumper plus a memory-inspection trick; sample repo chromatic_paragraphs is provided.

AI-written summary · about

  1. 0:00Introduction and setup
  2. 4:13Learning objectives
  3. 5:14Paragraph module overview
  4. 6:30The pre-processing recipe
  5. 8:28Implementing the workflow
  6. 13:05Optimization with services
  7. 15:32Handling nested entities
  8. 17:10Component-based use cases
  9. 19:16Debugging techniques
  10. 20:56Q&A and closing remarks
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.