Layout Paragraphs: Twig template suggestions

Created on 30 May 2023, over 1 year ago
Updated 31 May 2023, over 1 year ago

Problem/Motivation

I don't see when Layout Paragraph templates are ever suggested despite there being a hook_theme_suggestions_HOOK which appears to want to latch onto module-defined theme hook `layout_paragraphs`.

Steps to reproduce

* Enable twig debug so that suggestions are shown in html source
* With content placed with Layout Paragraphs system, view html source.

No twig suggestions from this module.

Proposed resolution

I see where a module-specific hook `hook_template_suggestions_layout_paragraphs` is defined in `layout_paragraphs_theme()`, but I am not sure how to get it to invoke.

Side note: The format of the function signature comment cites an invalid them function name. Please consider:
```
- * Implements hook_theme_suggestions().
+ * Implements hook_theme_suggestions_HOOK().
```

Remaining tasks

User interface changes

API changes

Data model changes

Excellent module -- I am loving the journey on which it is taking me and the promise of a bright, big, beautiful tomorrow!

πŸ’¬ Support request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States texas-bronius

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @texas-bronius
  • πŸ‡ΊπŸ‡ΈUnited States texas-bronius

    ```
    /**
    * Implements hook_theme_suggestions_HOOK().
    */
    function layout_paragraphs_theme_suggestions_field(array $variables) {
    $suggestions = [];
    if ($variables['element']['#formatter'] === 'layout_paragraphs') {
    ...
    ```
    This feels to be generally in the right direction, but I am not certain. Also feels a bit rigid and not as abstract as Drupal would have it.

  • πŸ‡ΊπŸ‡ΈUnited States texas-bronius
Production build 0.71.5 2024