diff --git a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php index ac57e3a..32016a8 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php +++ b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php @@ -129,6 +129,9 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta if ($entity_type_id == 'node') { $target_bundles_title = $this->t('Content types'); } + elseif ($entity_type_id == 'taxonomy_term') { + $target_bundles_title = $this->t('Vocabularies'); + } $form['target_bundles'] = array( '#type' => 'checkboxes', diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php index 54c87f1..489eef2 100644 --- a/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php +++ b/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php @@ -232,7 +232,7 @@ public function testMultipleTargetTaxonomyVocabularies() { $vocabularies[$i]->save(); } - // Create a new filed pointing to the first vocabulary. + // Create a new field pointing to the first vocabulary. $field_name = $this->createEntityReferenceField('taxonomy_term', [$vocabularies[0]->id()]); $field_name = "field_$field_name"; $field_id = 'node.' . $this->type . '.' . $field_name; diff --git a/core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php b/core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php index eae5103..50200db 100644 --- a/core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php +++ b/core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php @@ -39,7 +39,6 @@ public function entityQueryAlter(SelectInterface $query) { public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form = parent::buildConfigurationForm($form, $form_state); - $form['target_bundles']['#title'] = $this->t('Vocabularies'); $form['target_bundles']['#ajax'] = TRUE; $form['target_bundles']['#limit_validation_errors'] = []; @@ -47,19 +46,19 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta '#type' => 'submit', '#value' => $this->t('Update bundles'), '#limit_validation_errors' => [], - '#attributes' => array( - 'class' => array('js-hide'), - ), - '#submit' => array('entity_reference_settings_ajax_submit'), + '#attributes' => [ + 'class' => ['js-hide'], + ], + '#submit' => ['entity_reference_settings_ajax_submit'], ]; // @todo: Currently allow auto-create only on taxonomy terms. - $form['auto_create'] = array( + $form['auto_create'] = [ '#type' => 'checkbox', '#title' => $this->t("Create referenced entities if they don't already exist"), '#default_value' => isset($this->configuration['handler_settings']['auto_create']) ? $this->configuration['handler_settings']['auto_create'] : FALSE, '#weight' => 20, - ); + ]; $bundles = array_intersect_key($form['target_bundles']['#options'], $form['target_bundles']['#default_value']); $form['auto_create_bundle'] = [ @@ -83,7 +82,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta * {@inheritdoc} */ public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { - $form_state->unsetValue(array('field', 'settings', 'handler_settings', 'target_bundles_update')); + $form_state->unsetValue(['field', 'settings', 'handler_settings', 'target_bundles_update']); } /** @@ -94,7 +93,7 @@ public function getReferenceableEntities($match = NULL, $match_operator = 'CONTA return parent::getReferenceableEntities($match , $match_operator, $limit); } - $options = array(); + $options = []; $bundles = $this->entityManager->getBundleInfo('taxonomy_term'); $handler_settings = $this->configuration['handler_settings'];