I need to output link to referenced entity with a custom text like: "Details..." or "Read more..." but there is no such a formatter. I think its worth it to add one.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

OnkelTem’s picture

Assigned: Unassigned » OnkelTem
Status: Active » Needs review
FileSize
38.1 KB
3.31 KB

Ok, this patch extends "Label" formatter behavior allowing for custom text.
er.png
Suggestions are welcome. Also please review the part where custom text goes through t().

OnkelTem’s picture

Code cleanup. (Warm greetings to Eclipse/PDT developers for the "smart" editor)

raincloud’s picture

I was looking for a solution like this. This patch is working very well on my site. Comparing with the screenshot, I have only "Custom Text" box and not the other boxes ("Field Template" or "Label") - perhaps those boxes come from certain other modules which I don't use.

OnkelTem’s picture

@raincloud

Thanks for testing this.
Sorry for the confusing screenshot, those forms fields come from Display Suite module.

jimmynash’s picture

Applied patch in #2 to 7.x-1.0 and it works great for me.

Thanks!

OnkelTem’s picture

Status: Needs review » Reviewed & tested by the community

Taking confirmation from #5 as the reason.

OnkelTem’s picture

Issue summary: View changes

asd

John Pitcairn’s picture

Issue summary: View changes

I think this would need to be ported to Drupal 8 core entityreference field to get any further attention?

It is possible to implement the patch in a custom module providing the formatter. I can throw that into a self-contained sandbox module if anyone is interested.

MorinLuc0’s picture

Status: Reviewed & tested by the community » Needs work

Missing test cases for new functionality.

adr_p’s picture

Adjusting for 7.x-1.5.