Issue #3190231 by Matroskeen: Incorrect example of checking field name in hook_options_list_alter()

merge-requests/268/head
catch 2021-01-22 19:27:24 +00:00
parent 26130ff273
commit 8d2875cc6d
1 changed files with 1 additions and 1 deletions

View File

@ -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 ==');
}