Issue #3190231 by Matroskeen: Incorrect example of checking field name in hook_options_list_alter()
parent
26130ff273
commit
8d2875cc6d
|
|
@ -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 ==');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue