Commit 197fa45d authored by webchick's avatar webchick
Browse files

Issue #2513396 by Cottser, larowlan, HelloNewman, webchick, crowdg, Bojhan,...

Issue #2513396 by Cottser, larowlan, HelloNewman, webchick, crowdg, Bojhan, eliza411, ivanstegic, LewisNyman, lunk_rat, nickrosencrans, stpaultim: There is no link, anywhere, to a contact form once a user creates it
parent d7f1914c
......@@ -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'
......
......@@ -10,6 +10,7 @@
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Link;
/**
* Defines a class to build a listing of contact form entities.
......@@ -32,13 +33,14 @@ public function buildHeader() {
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
$row['form'] = $this->getLabel($entity);
// Special case the personal form.
if ($entity->id() == 'personal') {
$row['form'] = $this->getLabel($entity);
$row['recipients'] = t('Selected user');
$row['selected'] = t('No');
}
else {
$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'));
......
......@@ -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",
......
......@@ -250,10 +250,17 @@ 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]', [
':href' => \Drupal::url('entity.contact_form.canonical', ['contact_form' => $contact_form]),
':text' => $label,
]
);
$this->assertTrue(!empty($view_link), 'Contact listing links to contact form.');
// Find out in which row the form we want to add a field to is.
$i = 0;
foreach($this->xpath('//table/tbody/tr') as $row) {
if (((string)$row->td[0]) == $label) {
if (((string) $row->td[0]->a) == $label) {
break;
}
$i++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment