diff -u b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.php b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.php --- b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.php @@ -497,7 +497,6 @@ * * @return array * An array with the following keys: - * - cache_id * - field_name * - type * - label @@ -506,12 +505,11 @@ * - cardinality * - required * - description - * - columns - * - module + * - property_names */ public function getFieldDefinition() { + $schema = $this->getSchema(); $field_definition = array( - 'cache_id' => $this->uuid(), 'field_name' => $this->id, 'type' => $this->type, 'label' => $this->label(), @@ -520,8 +518,7 @@ 'cardinality' => $this->cardinality, 'required' => FALSE, 'description' => '', - 'columns' => $this['columns'], - 'module' => $this->module, + 'property_names' => array_keys($schema['columns']), ); return $field_definition; } diff -u b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php --- b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php @@ -459,7 +459,6 @@ * * @return array * An array with the following keys: - * - cache_id * - field_name * - type * - label @@ -468,12 +467,11 @@ * - cardinality * - required * - description - * - columns - * - module + * - property_names */ public function getFieldDefinition() { + $schema = $this->field->getSchema(); $field_definition = array( - 'cache_id' => $this->uuid(), 'field_name' => $this->field->id, 'type' => $this->field->type, 'label' => $this->label(), @@ -482,8 +480,7 @@ 'cardinality' => $this->field->cardinality, 'required' => $this->required, 'description' => $this->description, - 'columns' => $this->field['columns'], - 'module' => $this->field->module, + 'property_names' => array_keys($schema['columns']), ); return $field_definition; } diff -u b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php --- b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php @@ -259,7 +259,6 @@ '#field_name' => $this->field_definition['field_name'], '#language' => $langcode, '#field_parents' => $form['#parents'], - '#columns' => array_keys($this->field_definition['columns']), // Only the first widget should be required. '#required' => $delta == 0 && $this->field_definition['required'], '#delta' => $delta, diff -u b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetInterface.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetInterface.php --- b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetInterface.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetInterface.php @@ -86,7 +86,6 @@ * $form_state['values'], and is used to access processing information * for the field through the field_form_get_state() and * field_form_set_state() functions. - * - #columns: A list of field storage columns of the field. * - #title: The sanitized element label for the field instance, ready for * output. * - #description: The sanitized element description for the field instance, diff -u b/core/modules/options/lib/Drupal/options/Plugin/field/widget/OptionsWidgetBase.php b/core/modules/options/lib/Drupal/options/Plugin/field/widget/OptionsWidgetBase.php --- b/core/modules/options/lib/Drupal/options/Plugin/field/widget/OptionsWidgetBase.php +++ b/core/modules/options/lib/Drupal/options/Plugin/field/widget/OptionsWidgetBase.php @@ -34,12 +34,22 @@ protected $column; /** + * The name of the module that provides the field type. + * + * @var string + */ + protected $field_type_module; + + /** * {@inheritdoc} */ public function __construct($plugin_id, array $plugin_definition, array $field_definition, array $settings, $weight) { parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $weight); - $this->column = key($this->field_definition['columns']); + $this->column = $this->field_definition['property_names'][0]; + + $field_type_info = field_info_field_types($this->field_definition['type']); + $this->field_type_module = $field_type_info['module']; } /** @@ -113,7 +123,7 @@ $module_handler = \Drupal::moduleHandler(); // Get the list of options from the field type module, and sanitize them. - $options = (array) $module_handler->invoke($this->field_definition['module'], 'options_list', array($this->field_definition, $this->entity)); + $options = (array) $module_handler->invoke($this->field_type_module, 'options_list', array($this->field_definition, $this->entity)); // Add an empty option if the widget needs one. if ($empty_option = $this->getEmptyOption()) { diff -u b/core/modules/options/options.module b/core/modules/options/options.module --- b/core/modules/options/options.module +++ b/core/modules/options/options.module @@ -237,7 +237,8 @@ function options_allowed_values(array $field_definition, EntityInterface $entity = NULL) { $allowed_values = &drupal_static(__FUNCTION__, array()); - if (!isset($allowed_values[$field_definition['cache_id']])) { + $cache_id = serialize($field_definition); + if (!isset($allowed_values[$field_definition[$cache_id]])) { $function = $field_definition['settings']['allowed_values_function']; // If $cacheable is FALSE, then the allowed values are not statically // cached. See options_test_dynamic_values_callback() for an example of @@ -251,14 +252,14 @@ } if ($cacheable) { - $allowed_values[$field_definition['cache_id']] = $values; + $allowed_values[$field_definition[$cache_id]] = $values; } else { return $values; } } - return $allowed_values[$field_definition['cache_id']]; + return $allowed_values[$field_definition[$cache_id]]; } /** only in patch2: unchanged: --- a/core/modules/field/field.attach.inc +++ b/core/modules/field/field.attach.inc @@ -775,7 +775,6 @@ function _field_invoke_widget_target() { * '#default_value' => The field value for delta 0, * '#required' => Whether the widget should be marked required, * '#delta' => 0, - * '#columns' => The array of field columns, * // The remaining elements in the sub-array depend on the widget. * '#type' => The type of the widget, * ... @@ -787,7 +786,6 @@ function _field_invoke_widget_target() { * // Only for multiple widgets: * '#entity_type' => The name of the entity type, * '#bundle' => $instance['bundle'], - * '#columns' => array_keys($field['columns']), * // The remaining elements in the sub-array depend on the widget. * '#type' => The type of the widget, * ...