Problem/Motivation
\Drupal\Core\Field\FieldTypePluginManager::getPluginClass()
calls getDefinition()
with $exception_on_invalid = FALSE
for.. historical reasons. It was initially introduced like that in #2293773: Field allowed values use dots in key names - not allowed in config probably because field widgets and formatters were also using $exception_on_invalid = FALSE
, but the difference is that those two plugin types can fall back to a default widget/formatter, while a field type has no fallback.
Proposed resolution
Make \Drupal\Core\Field\FieldTypePluginManager::getPluginClass()
throw the standard plugin not found exception.
This also fixes PHP 7.4 compatibility problems because the return statement of getPluginClass()
will never be reached with an empty $plugin_definition
variable.
Remaining tasks
Review.
User interface changes
Nope.
API changes
Nope.
Data model changes
Nope.
Release notes snippet
Nope.