diff --git a/core/lib/Drupal/Core/Field/FormatterPluginManager.php b/core/lib/Drupal/Core/Field/FormatterPluginManager.php index c4df0f5f2fd8c65812d14eed857d0ee96e8a66a3..46305a5f2b9d735fead732b33ba5900d1a4e4f1c 100644 --- a/core/lib/Drupal/Core/Field/FormatterPluginManager.php +++ b/core/lib/Drupal/Core/Field/FormatterPluginManager.php @@ -90,8 +90,8 @@ public function createInstance($plugin_id, array $configuration = []) { * - third_party_settings: (array) Settings provided by other extensions * through hook_field_formatter_third_party_settings_form(). * - * @return \Drupal\Core\Field\FormatterInterface|null - * A formatter object or NULL when plugin is not found. + * @return \Drupal\Core\Field\FormatterInterface|false + * A formatter object or FALSE when plugin is not found. */ public function getInstance(array $options) { $configuration = $options['configuration']; @@ -114,7 +114,7 @@ public function getInstance(array $options) { // Grab the default widget for the field type. $field_type_definition = $this->fieldTypeManager->getDefinition($field_type); if (empty($field_type_definition['default_formatter'])) { - return NULL; + return FALSE; } $plugin_id = $field_type_definition['default_formatter']; } @@ -123,7 +123,7 @@ public function getInstance(array $options) { 'field_definition' => $field_definition, 'view_mode' => $options['view_mode'], ]; - return $this->createInstance($plugin_id, $configuration); + return $this->createInstance($plugin_id, $configuration) ?? FALSE; } /** diff --git a/core/lib/Drupal/Core/Field/WidgetPluginManager.php b/core/lib/Drupal/Core/Field/WidgetPluginManager.php index e5afb21e5fcd8fb732ecb86606e14a29488382fb..a2366f322706acf7f7fb288480d1773cbaa13873 100644 --- a/core/lib/Drupal/Core/Field/WidgetPluginManager.php +++ b/core/lib/Drupal/Core/Field/WidgetPluginManager.php @@ -69,8 +69,8 @@ public function __construct(\Traversable $namespaces, CacheBackendInterface $cac * - third_party_settings: (array) Settings provided by other extensions * through hook_field_formatter_third_party_settings_form(). * - * @return \Drupal\Core\Field\WidgetInterface|null - * A Widget object or NULL when plugin is not found. + * @return \Drupal\Core\Field\WidgetInterface|false + * A Widget object or FALSE when plugin is not found. */ public function getInstance(array $options) { // Fill in defaults for missing properties. @@ -99,7 +99,7 @@ public function getInstance(array $options) { // Grab the default widget for the field type. $field_type_definition = $this->fieldTypeManager->getDefinition($field_type); if (empty($field_type_definition['default_widget'])) { - return NULL; + return FALSE; } $plugin_id = $field_type_definition['default_widget']; } @@ -107,7 +107,7 @@ public function getInstance(array $options) { $configuration += [ 'field_definition' => $field_definition, ]; - return $this->createInstance($plugin_id, $configuration); + return $this->createInstance($plugin_id, $configuration) ?? FALSE; } /**