Add a link to content to the formatter

Created on 30 November 2022, about 2 years ago
Updated 1 February 2024, 11 months ago

Problem/Motivation

I use the formatter "PDF: Display the first page" on my teaser. I would like to have a link to the content on the canvas image.

Proposed resolution

I modified the file \pdf\src\Plugin\Field\FieldFormatter\PdfThumbnail.php
But I don't know how to do a patch file.

It works !! But it will be perfect to be included in a released versions.

Feature request
Status

Needs review

Version

1.1

Component

User interface

Created by

🇧🇪Belgium spols

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Hello, first of all thanks for this message because it has been helpful to me. I have used the attached file to replace the PdfThumbnail.php file in order to be able to link the content from the canvas image. I was getting an error because apparently the render() call used is not working on Drupal anymore, but I was able to fix it. I'm attaching here the file with the fixed piece of code in case somebody wants to use it.

    I just have a problem that I don't know if can be fixed on the code or requires of me to do something else. Using the attached file I get the link to the content properly, but I'm using PathAuto module to generate custom paths for every page. When I use this file attached here the generated link to the content is linking to the path without the generated path, so it's something like
    mywebsite.com/node/15/ but the real link of the content is the one with the auto generated path, so it should be mywebsite.com/my-content-page.
    Does somebody know if there is a way for me to modify the code so that instead of the code with the "node/15" url it will be linking to the code that is generated by pathauto, so that it would be "my-content-page"? I don't know if that's something easy to do within the code or I should use some external module to somehow convert these links. I have been trying to change the code and looking for other options but I didn't find anything that works. If somebody could help me with this I would appreciate.

    Attached is the modified file from #1 that is working properly right now in Drupal 10.

    Thank you

  • Assigned to ushma
  • 🇮🇳India ushma

    I have created a patch using the attched text file and also fixed the url issue. It will now show node alias instead of drupal internal path. Please verify this.

  • Status changed to Needs review 11 months ago
  • Issue was unassigned.
Production build 0.71.5 2024