diff --git a/core/modules/views/config/schema/views.area.schema.yml b/core/modules/views/config/schema/views.area.schema.yml index f2f3f1d..244f022 100644 --- a/core/modules/views/config/schema/views.area.schema.yml +++ b/core/modules/views/config/schema/views.area.schema.yml @@ -10,7 +10,7 @@ views.area.entity: mapping: entity_id_uuid: type: string - label: 'ID' + label: 'Entity ID or UUID' view_mode: type: string label: 'View mode' diff --git a/core/modules/views/src/Plugin/views/area/Entity.php b/core/modules/views/src/Plugin/views/area/Entity.php index 3d4a280..e1e9f75 100644 --- a/core/modules/views/src/Plugin/views/area/Entity.php +++ b/core/modules/views/src/Plugin/views/area/Entity.php @@ -101,13 +101,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['view_mode'] = array( '#type' => 'select', - '#options' => \Drupal::entityManager()->getViewModeOptions($this->entityType), + '#options' => $this->entityManager->getViewModeOptions($this->entityType), '#title' => $this->t('View mode'), '#default_value' => $this->options['view_mode'], ); + $label = $this->entityManager->getDefinition($this->entityType)->getLabel(); $form['entity_id_uuid'] = [ - '#title' => $this->t('Entity ID or UUID'), + '#title' => $this->t('@entity_type_label ID or UUID', ['@entity_type_label' => $label]), '#type' => 'textfield', '#default_value' => $this->options['entity_id_uuid'], '#autocomplete_route_name' => 'system.entity_autocomplete', @@ -128,6 +129,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { public function submitOptionsForm(&$form, FormStateInterface $form_state, &$options = []) { parent::submitOptionsForm($form, $form_state); + // Always try to store the UUID, if possible. if ($entity = $this->entityManager->getStorage($this->entityType)->load($options['entity_id_uuid'])) { $options['entity_id_uuid'] = $entity->uuid(); }