Part ofand followup to :
In both cases (formatters / widgets), the rendering / form building flow for entities need to be reworked so that formatters / widgets are invoked on "base fields" as well. Right now, they are only invoked for "configurable fields", within field_attach_[prepare_view|view]() / field_attach[form|extract_form_values|form_validate]() respectively.
This issue is the start of that.
- Patch changes field_invoke_method*() so that they iterate on all fields (base + configurable) of a entity, instead of just configurable fields so far. Those functions, along with field_attach_form*() / field_attach_view*(), are up for removal / replacement by OO versions in , but this patch here keeps them in field.module for now.
- As a result, widgets/formatters get invoked on any (base or config) field for which the EntityDisplay used for rendering contains the configuration of a widget/formatter. Free support for "In place editing" ensues.
- For now, Field UI "Manage display" screens still only list configurable fields, so EntityDisplay objects cannot be saved with widgets/formatters for base fields, thus all of them, except node title, are still rendered with their own custom code, as in HEAD. has been opened to allow Field UI integration.
- Patch moves the drupal_alter() step from the callers of entity_get_render_display() / entity_get_render_form_display() into the functions themselves, because per below, now that we have a use case of an alter implementation, we need to ensure that it always runs.
For node title:
- Patch removes the custom $form['title'] element
- Uses hook_entity_display_alter() to runtime-alter the EntityDisplay before rendering a node, adding hardcoded widget/formatter display options for the 'title' component
- Updates all WebTests posting node forms accordingly ($edit['title'] -> $edit['title[value]'])
- Since node title is now themed as a field, the patch adds a theme_field__node__title() to override theme_field()'s generic wrappers with a lighter-weight
<span>wrapper. Prior to this patch, the node title was output (in node listings) with no wrapper of its own (only the
<a>output by node.html.twig), so this results in a new
<span>tag where there wasn't one before, but that's needed to hold the attributes required for in-place editing to work.
|PASSED: [[SimpleTest]]: [MySQL] 59,105 pass(es). |
[ View ]
|PASSED: [[SimpleTest]]: [MySQL] 59,210 pass(es). |
[ View ]