Problem/Motivation

The entity containing a broken link is shown in the report via views field 'Page entity label' (LinkcheckerLinkPageEntityLabel).

If the entity is translated it is shown with wrong label and linked to wrong translation.

Steps to reproduce

  • Create node type with link field checked by linkchecker
  • Add node with broken URL
  • Translate node, remember to translate the node title
  • Run broken links cron
  • Check broken links report (Administration > Reports > Broken links):
    both nodes are shown with correct "Language: ..." but label and link are the same.

Proposed resolution

Check in LinkcheckerLinkPageEntityLabel::render() if $linked_entity is translatable and translate it accordingly.

Remaining tasks

Testing would be great.

User interface changes

Broken links report shows translated title and links to translated entity.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

gngn created an issue. See original summary.

gngn’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new1.13 KB

Patch as proposed above.

Feedback welcome.

eiriksm’s picture

Issue tags: +Needs tests

Very cool, thanks! ❤️

Are you able to write a small test for this as well?

gngn’s picture

@eiriksm thank you :)

About "a small test for this" ... I can give it a try (I don't have much experience with drupal tests though).

gngn’s picture

I still have no test - but I tested a bit.

Turns out I forgot to check if the $linked_entity actually has the translation.
So #2 fails e.g. with a pararaph embedded in an untranslated node.
Fixed.

carlitus’s picture

The patch #5 works well for me. Attached screenshots:

The field in english:
Field in english

The field in spanish:
Field in spanish

Reports without patch, where it shows the link to wrong language:
Reports without patch

Reports with the patch, where it shows the link to right language:
Reports with the patch

Thanks @gngn!

lisotton’s picture

Status: Needs review » Reviewed & tested by the community

I tested and it works fine.
Moving to RTBC also according to @carlitus evidences.

eiriksm’s picture

Status: Reviewed & tested by the community » Needs work

Still needs tests ✌️🤓

Also, please use a merge request so the testing pipelines can run

shivam_tiwari’s picture

Assigned: Unassigned » shivam_tiwari

I am working here.

shivam_tiwari’s picture

Version: 8.x-1.x-dev » 2.1.x-dev

shivam_tiwari’s picture

Assigned: shivam_tiwari » Unassigned
Status: Needs work » Needs review

Created MR 106 for the latest development version. Pipeline is green so moving it to Needs Review.

eiriksm’s picture

Status: Needs review » Fixed

Alright looks simple enough. Let's do tests in a follow up

Thank to everyone who worked on this! ♥️🚀

eiriksm’s picture

c-logemann’s picture

c-logemann’s picture

Oh, was already connected as parent issue. Sorry for the noise.

Status: Fixed » Closed (fixed)

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