diff --git a/core/modules/options/lib/Drupal/options/Plugin/field/widget/OptionsWidgetBase.php b/core/modules/options/lib/Drupal/options/Plugin/field/widget/OptionsWidgetBase.php index 3c0d841..1d18356 100644 --- a/core/modules/options/lib/Drupal/options/Plugin/field/widget/OptionsWidgetBase.php +++ b/core/modules/options/lib/Drupal/options/Plugin/field/widget/OptionsWidgetBase.php @@ -57,7 +57,6 @@ public function __construct($plugin_id, array $plugin_definition, FieldDefinitio public function formElement(FieldInterface $items, $delta, array $element, $langcode, array &$form, array &$form_state) { // Prepare some properties for the child methods to build the actual form // element. - $this->entity = $element['#entity']; $this->required = $element['#required']; $cardinality = $this->fieldDefinition->getFieldCardinality(); $this->multiple = ($cardinality == FIELD_CARDINALITY_UNLIMITED) || ($cardinality > 1); @@ -115,8 +114,8 @@ public static function validateElement(array $element, array &$form_state) { /** * Returns the array of options for the widget. * - * @param FieldItemInterface $item - * The field item value(s). + * @param \Drupal\Core\Entity\Field\FieldItemInterface $item + * The field item. * * @return array * The array of options for the widget. @@ -145,7 +144,7 @@ protected function getOptions(FieldItemInterface $item) { $context = array( 'fieldDefinition' => $this->fieldDefinition, - 'entity' => $this->entity, + 'entity' => $item->getParent()->getParent(), ); $module_handler->alter('options_list', $options, $context);