Update field_example to demonstrate configurable field formatter plugins

Created on 25 May 2022, about 3 years ago
Updated 17 February 2023, over 2 years ago

Problem/Motivation

It would be nice to have the field_example module demonstrate how a formatter plugin can expose user definable configuration on the manage display page.

Proposed resolution

Update one of the two existing formatter plugins so that it provides a configuration option. Right now they're both pretty simple formatters and we can make one of the two more complex without detracting from the learning experience.

This updates the \Drupal\field_example\Plugin\Field\FieldFormatter\ColorBackgroudFormatter plugin so that it has a user defined configuration option which can toggle on/off some additional logic that will attempt to automatically set the foreground color of the text depending on the lightness of the background color. This seemed like a real use-case without requiring a lot of extra code unrelated to thing we're trying to demonstrate which is how to make a formatter configurable.

✨ Feature request
Status

Fixed

Version

3.0

Component

Field Example

Created by

πŸ‡ΊπŸ‡ΈUnited States eojthebrave Minneapolis, MN

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024