Skip to content
Snippets Groups Projects
Commit c2484c98 authored by Adam Bramley's avatar Adam Bramley
Browse files

Simplify ternary, expand test comment

parent a6f1bab0
No related branches found
No related tags found
1 merge request!8877Issue #2866619 by kksandr: added link access check to the node form
......@@ -281,8 +281,7 @@ public function save(array $form, FormStateInterface $form_state) {
$node->save();
$node_link = $node->toLink($this->t('View'))->toString();
$context = ['@type' => $node->getType(), '%title' => $node->label(), 'link' => $node_link];
$node_t_link = $node->toLink($node->label());
$t_args = ['@type' => node_get_type_label($node), '%title' => $node_t_link->getUrl()->access() ? $node_t_link->toString() : $node_t_link->getText()];
$t_args = ['@type' => node_get_type_label($node), '%title' => $node->access('view') ? $node->toLink()->toString() : $node->label()];
if ($insert) {
$this->logger('content')->info('@type: added %title.', $context);
......
......@@ -183,7 +183,8 @@ public function testUnpublishedNodeCreation(): void {
// Confirm that the node was created.
$this->assertSession()->pageTextContains('Basic page ' . $edit['title[0][value]'] . ' has been created.');
// Verify that the creation message doesn't contain a link to a node.
// Verify that the creation message doesn't contain a link to a node since
// the user cannot view unpublished nodes.
$this->assertSession()->elementNotExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "node/")]');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment