Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292974

Mechanism to disable preprocessing of node base fields so they can be configured via the field UI

$
0
0

Problem/Motivation

As discussed in #2353867: [META] Expose Title and other base fields in Manage Display, sitebuilders cannot configure the display of node's title even though they often want to.

Worse, even if developers use a hook to modify the node's title field adding ->setDisplayConfigurable('view', TRUE), and a sitebuilder then enables the title field in a view mode, it makes no difference. The template_preprocess_node and the node.html.twig take over the rendering of the node's title, ignoring the configured view displays. The same problem applies to the 'created' and 'uid' fields.

This issue has been split from #2353867: [META] Expose Title and other base fields in Manage Display to contain minimal, back-compatible changes providing an important first step to solving the original problem.

Proposed resolution

Use an additional entity type property to allow disabling of extra preprocessing of node base fields (title, created and uid).

Remaining tasks

None.

This issue has been thoroughly reviewed including:

  • Sub-system maintainer review by @lauriii in #97
  • Expert review by @Berdir in #83
  • Various community reviewers and testers (also see recent comments on #2353867)

User interface changes

None

API changes

Node title, uid and created fields are now configurable via the field UI. Furthermore developers who wished enable that have until now been obstructed by special preprocessing. A module can now disable this preprocessing by means of an additional entity type property:

function XXX_entity_type_build(array &$entity_types) {
  $entity_types['node']->set('node_basefield_skip_preprocess', TRUE);
}

Using this feature requires an update to the node template to treat related variables as optional (label, author_name, date). Theme developers should update their themes to match the changes made in core. No changes are required for sites that do not use this feature.

Data model changes

None

Release notes snippet

It is now easier to make node base fields configurable via the field UI due to a mechanism to disable preprocessing of node base fields. This a step towards making title display configurable in Drupal Core and in the meantime there is a contrib module to enable it. These changes are fully back-compatible.


Viewing all articles
Browse latest Browse all 292974

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>