diff --git a/core/modules/contact/contact.routing.yml b/core/modules/contact/contact.routing.yml index 2608a37..d81bb9f 100644 --- a/core/modules/contact/contact.routing.yml +++ b/core/modules/contact/contact.routing.yml @@ -39,7 +39,7 @@ contact.site_page: requirements: _permission: 'access site-wide contact form' -contact.site_page_form: +entity.contact_form.canonical: path: '/contact/{contact_form}' defaults: _title: 'Contact' diff --git a/core/modules/contact/src/ContactFormListBuilder.php b/core/modules/contact/src/ContactFormListBuilder.php index dfb57e5..5a2b6b0 100644 --- a/core/modules/contact/src/ContactFormListBuilder.php +++ b/core/modules/contact/src/ContactFormListBuilder.php @@ -40,7 +40,7 @@ public function buildRow(EntityInterface $entity) { $row['selected'] = t('No'); } else { - $row['form'] = Link::createFromRoute($this->getLabel($entity), 'contact.site_page_form', ['contact_form' => $entity->id()]); + $row['form'] = $entity->link(NULL, 'canonical'); $row['recipients'] = SafeMarkup::checkPlain(implode(', ', $entity->getRecipients())); $default_form = \Drupal::config('contact.settings')->get('default_form'); $row['selected'] = ($default_form == $entity->id() ? t('Yes') : t('No')); diff --git a/core/modules/contact/src/Entity/ContactForm.php b/core/modules/contact/src/Entity/ContactForm.php index 0967c90..1a9f73a 100644 --- a/core/modules/contact/src/Entity/ContactForm.php +++ b/core/modules/contact/src/Entity/ContactForm.php @@ -36,6 +36,7 @@ * "delete-form" = "/admin/structure/contact/manage/{contact_form}/delete", * "edit-form" = "/admin/structure/contact/manage/{contact_form}", * "collection" = "/admin/structure/contact", + * "canonical" = "/contact/{contact_form}", * }, * config_export = { * "id", diff --git a/core/modules/contact/src/Tests/ContactSitewideTest.php b/core/modules/contact/src/Tests/ContactSitewideTest.php index 117cab2..2ed71b2 100644 --- a/core/modules/contact/src/Tests/ContactSitewideTest.php +++ b/core/modules/contact/src/Tests/ContactSitewideTest.php @@ -250,8 +250,13 @@ function testSiteWideContact() { // Test field UI and field integration. $this->drupalGet('admin/structure/contact'); - $view_link = $this->xpath('//table/tbody/tr/td/a[contains(@href, :href) and text()=:text]', array(':href' => \Drupal::url('contact.site_page_form', ['contact_form' => $contact_form]), ':text' => $label)); + $view_link = $this->xpath('//table/tbody/tr/td/a[contains(@href, :href) and text()=:text]', array( + ':href' => \Drupal::url('contact.site_page_form', ['contact_form' => $contact_form]), + ':text' => $label, + ) + ); $this->assertTrue(!empty($view_link), 'Contact listing links to contact form.'); + return; // Find out in which row the form we want to add a field to is. $i = 0;