diff --git a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php index be3734d..ae7b56e 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php +++ b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php @@ -879,4 +879,14 @@ function field_langcode(EntityInterface $entity) { } } + /** + * {@inheritdoc} + */ + public function getAdditionalDependencies() { + // Add the module providing the configured field as a dependency. + $field = FieldHelper::fieldInfo()->getField($this->definition['entity_type'], $this->definition['field_name']); + return array($field->get('module')); + } + + } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php index aaae022..f79061c 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php @@ -423,4 +423,13 @@ public static function preRenderFlattenData($form) { return $form; } + /** + * Returns an array of additional dependencies for this plugin. + * + * @return array + */ + public function getAdditionalDependencies() { + return array(); + } + } diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigHandler.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigHandler.php index c82cd07..d4388a2 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigHandler.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigHandler.php @@ -238,6 +238,12 @@ public function submitForm(array &$form, array &$form_state) { // extra stuff on the form is not sent through. $handler->unpackOptions($handler->options, $options, NULL, FALSE); + // Add any additional dependencies as the handler is saved. Put it here so + // it does not need to be declared in defineOptions(). + if ($additional_dependencies = $handler->getAdditionalDependencies()) { + $handler->options['additional_dependencies'] = $additional_dependencies; + } + // Store the item back on the view $executable->setHandler($form_state['display_id'], $form_state['type'], $form_state['id'], $handler->options);