Skip to content

Provide Certain Section Configuration to Block and Field Templates #1

Description

@macburgee1

Problem/Motivation

It would be useful for section classes and section packages to be made available to block and field templates. For example, if the section background is dark, then that information could be used by a field templates to add dcf-inverse to an <h2> element.

Proposed resolution

Use preprocess functions to pass section classes and section packages to field and block templates:

template_preprocess_layout()
template_preprocess_block()
template_preprocess_field()

Section packages will be transformed into an array of their respective classes. Section classes will only be available if the given template is rendered in a layout. (Blocks can still be placed outside of layouts.)

Remaining tasks

  • Submit patch
  • Review
  • Commit

User interface changes

None.

API changes

Section classes now will be available in block and field templates. We should document this.

Data model changes

None.

Release notes snippet

None. We're still in development release.

Originally report from Drupal.org

https://www.drupal.org/project/dcf/issues/3080719

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions