ElementInfoManager does not provide an alter hook, cannot alter element plugin definitions

Created on 20 July 2018, over 6 years ago
Updated 6 January 2025, 3 months ago

Problem/Motivation

ElementInfoManager does not provide an alterHook definition. This prevents altering element plugin definitions. As more and more contrib provide elements, sometimes it is required to override them for improvements. This is impossible for element plugins.

See alterDefinitions, where it is skipped if there is no alterHook

protected function alterDefinitions(&$definitions) {
    if ($this->alterHook) {
      $this->moduleHandler->alter($this->alterHook, $definitions);
    }
  }

Proposed resolution

Provide an alterHook definition. Invoke \Drupal\Core\Plugin\DefaultPluginManager::alterInfo in the consturctor so that end users can swap element classes.

Remaining tasks

Add patch.

API changes

Adds a new hook.

Release notes snippet

A new hook has been added to allow altering of render element plugins. Read the change record for more.

Feature request
Status

Fixed

Version

8.8 ⚰️

Component

render system

Created by

🇺🇸United States mglaman WI, USA

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