Issue #2788521 by david.gil, SteffenR: hook_options_list_alter sample fails on 8.1.8
parent
8d783b7c79
commit
8ee82f214b
|
@ -20,7 +20,7 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
|||
* properties.
|
||||
* @param array $context
|
||||
* An associative array containing:
|
||||
* - field_definition: The field definition
|
||||
* - fieldDefinition: The field definition
|
||||
* (\Drupal\Core\Field\FieldDefinitionInterface).
|
||||
* - entity: The entity object the field is attached to
|
||||
* (\Drupal\Core\Entity\EntityInterface).
|
||||
|
@ -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['field']->id() == 'field_option') {
|
||||
if ($context['fieldDefinition']->id() == 'field_option') {
|
||||
// Change the label of the empty option.
|
||||
$options['_none'] = t('== Empty ==');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue