Motivation

We want to be able to use field formatters as CE formatters. Generelly, every field formatter should be available via CE-formatters as well. The resulting string should be usable either as attribute or slot.

Proposed resolution

* Add one class for CoreFieldCeFormatter that takes care off invoking the configured core field formatter plugin
* Implement a plugin deriver to do so. That will register 1 plugin instance per field formatter.
* Make sure field formatters are only applicable when they are compatible with the field --> forward isApplicable call correctly.

For derivative plugins you can check https://www.sitepoint.com/tutorial-on-using-drupal-8-plugin-derivatives-...
The deriver makes sure to simply register the same plugin class multiple times. The plugin definition will differ by field, which the plugin-class can use/read to know which field-formatter to handle.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

fago created an issue. See original summary.

fago’s picture

Issue summary: View changes

fago’s picture

Status: Active » Needs review

I started with trying to make the UI basically work. Somehow the changes are partically not saved atm. After quite some trial and error I figured that it is related to the ajax reload.

-->
After re-factoring, it's basically working now. Opened #3443739: Make editing CE entity display basically work to work over the UI once we are fully done here and things work from a config.

I figured that entity-displays are still quite connect to core field formatters, what conceptually makes no sense in our case. We need to connect them to CE-field-formatters. For doing so, quite some changes were still needed to finish the introduction of CE-field-formatters. Thus, as a first step I worked over the code to make this work.

fago’s picture

Status: Needs review » Active

Created another branch and MR https://git.drupalcode.org/project/custom_elements/-/merge_requests/43 - which contains a first plugin for fields. For now, testing with a single 'timestamp' formatter.

Also, tried fixing the auto formatter, which needs work. It seems we need to improve our auto-processing to actually support a custom name to be given.

fago’s picture

fago’s picture

Status: Active » Needs work

fago’s picture

Status: Needs work » Needs review

finished step2 and made things work. Stumbled over quite some things, added lots of todos for them and created issues for 3.x.
Finally, I worked over tests and made them work again. Partially I added new display-ce configs to make things work, so we see them being taken into account.

Also, I had to work over the render pipeline such that it actually renders config first, and fallsback to processors second. Given that we should have the foundation for 3.x with this PR, but need to work through all of those smaller todos in follow-ups.

fago’s picture

Status: Needs review » Fixed

  • fago committed 2094ea7b on 3.x
    Issue #3440442 by fago: Add support for core field formatters and fix...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.