Skip to main content

Timeline for Global preprocess for all links

Current License: CC BY-SA 3.0

14 events
when toggle format what by license comment
Apr 19, 2018 at 10:25 comment added Ziftman This what is nice about Drupal, you can do what you want in many ways :)
Apr 19, 2018 at 10:23 comment added Hudri I finally used Stefanos' version, it better fits my use case. Your solution has the advantage of working with internal and external links, while Stefanos version only works with interal links. But Stefanos' version also works with links in text field, so I ended up using his solution. But thanks for your effort, it helped me understanding D8 better.
Apr 19, 2018 at 9:43 comment added Ziftman @Hudri for sure it will work with everything but not with the text which is stored inside fields, the links in the text it's not rendered by Drupal, there is another method to deal with that, you can solve it many ways, you would use the preprocess for the FIELD to add the suffix you want and this would use preg_match with regular expression to find all the links or you can use hook_ENTITY_TYPE_view
Apr 19, 2018 at 9:20 comment added Hudri Hm, seems to work very well with link fields, but not with links inside CKeditor / a textfield.
Apr 19, 2018 at 9:06 comment added Hudri Thanks, this is the starting point I needed, first tests look very promising
Apr 19, 2018 at 9:06 vote accept Hudri
Apr 19, 2018 at 9:13
Apr 18, 2018 at 16:19 history edited Ziftman CC BY-SA 3.0
added 33 characters in body
Apr 18, 2018 at 16:13 history edited Ziftman CC BY-SA 3.0
add more infomation
Apr 18, 2018 at 16:08 history edited Ziftman CC BY-SA 3.0
add more infomation
Apr 18, 2018 at 16:01 comment added Ziftman @Hudri that what you want?
Apr 18, 2018 at 15:57 history edited Ziftman CC BY-SA 3.0
Change the answer to fit the updated question
Apr 18, 2018 at 13:46 comment added Hudri Sorry for the unclear question, I've edited it according to @Stefanos Petrakis' comment on the question to make it more clear.
Apr 18, 2018 at 13:41 comment added Hudri Sorry, but I don't think this is related to my problem. If I understand it correctly, this modifies how the webform field is rendered on the node. But my problem is with links to the node anywhere on the site, e.g. a link to the enquiry node in a menu or a block.
Apr 18, 2018 at 12:23 history answered Ziftman CC BY-SA 3.0