Skip to content
Snippets Groups Projects
Commit f7361425 authored by Kristof De Jaeger's avatar Kristof De Jaeger
Browse files

Issue #2853906 by nedjo, Jelle_S, wesleydv: Submitted by field translation includes duplicate link

parent 92db179f
No related branches found
Tags 8.x-3.5
No related merge requests found
......@@ -69,11 +69,10 @@ class NodeSubmittedBy extends Date {
'#account' => $account,
];
return [
'#markup' => $this->t('Submitted by <a href=":user_link">@user</a> on @date.',
'#markup' => $this->t('Submitted by @user on @date.',
[
'@user' => $this->renderer->render($user_name),
'@date' => $this->dateFormatter->format($this->entity()->created->value, $date_format),
':user_link' => Url::fromUri('entity:user/' . $account->id())->toString(),
]
),
'#cache' => [
......
......@@ -73,7 +73,10 @@ class EntitiesTest extends TestBase {
$this->assertSession()->responseContains('group-left');
$this->assertSession()->responseContains('group-right');
$this->assertSession()->responseContains('<div class="field field--name-node-submitted-by field--type-ds field--label-hidden field__item">');
$this->assertSession()->pageTextContains('Submitted by ' . $this->adminUser->getDisplayName());
$elements = $this->xpath('//div[@class="field field--name-node-submitted-by field--type-ds field--label-hidden field__item"]');
// Because the user has 'access user profiles' permission, user name is
// rendered in a link.
$this->assertSession()->pageTextContains('Submitted by ' . $elements[0]->find('xpath', 'a')->getText() . ' on', 'Submitted by line found');
// Configure teaser layout.
$teaser = [
......
......@@ -90,6 +90,7 @@ abstract class TestBase extends BrowserTestBase {
$this->adminUser = $this->drupalCreateUser([
'access content',
'access in-place editing',
'access user profiles',
'admin classes',
'admin display suite',
'admin fields',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment