Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim created an issue. See original summary.

shashikant_chauhan’s picture

Assigned: Unassigned » shashikant_chauhan
shashikant_chauhan’s picture

Status: Active » Needs review
FileSize
1.96 KB

Adding patch.

joachim’s picture

Status: Needs review » Needs work

The changes to the docs file look good, but your patch has additional stuff in it.

(I would recommend the use of a git branch for each issue, to avoid this sort of problem, BTW.)

shashikant_chauhan’s picture

@jaochim, In sample code of hook_comment_links_alter
code: Url::fromRoute('comment_test.report', ['comment' => $entity->id()], ['query' => ['token' => \Drupal::getContainer()->get('csrf_token')->get("comment/{$entity->id()}/report")]])

The Url::fromRoute takes $route_name as a first parameter and in comment_test module comment_test.report route is defined, but in case of node_test module there was no such route defined. So I have created new route called "node_test.report" in node_test.routing.yml.

Should I remove the route "node_test.report" and its related code?

joachim’s picture

The route doesn't need to be a real route; this is just sample code. Or it could be a different route from node module, or from a test module.

shashikant_chauhan’s picture

Status: Needs work » Needs review
FileSize
749 bytes

Updated the patch.

joachim’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. Thanks for the patch!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +rc eligible

Committed and pushed 4a53d2f to 8.3.x and dfef782 to 8.2.x. Thanks!

This is rc eligible as documentation.

  • alexpott committed 4a53d2f on 8.3.x
    Issue #2806827 by shashikant_chauhan, joachim: incorrect sample code in...

  • alexpott committed dfef782 on 8.2.x
    Issue #2806827 by shashikant_chauhan, joachim: incorrect sample code in...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.