From 8d2875cc6dc23a3a5f493381dcebe8d73279aa00 Mon Sep 17 00:00:00 2001 From: catch Date: Fri, 22 Jan 2021 19:27:24 +0000 Subject: [PATCH] Issue #3190231 by Matroskeen: Incorrect example of checking field name in hook_options_list_alter() --- core/modules/options/options.api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/modules/options/options.api.php b/core/modules/options/options.api.php index 0f52b2befa9e..fbcc8093180c 100644 --- a/core/modules/options/options.api.php +++ b/core/modules/options/options.api.php @@ -30,7 +30,7 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; */ function hook_options_list_alter(array &$options, array $context) { // Check if this is the field we want to change. - if ($context['fieldDefinition']->id() == 'field_option') { + if ($context['fieldDefinition']->getName() == 'field_option') { // Change the label of the empty option. $options['_none'] = t('== Empty =='); }