This is a useful option in Views to disable the output of links (from $entity->content['links']) when outputting an entity since often you don't want the links to be output. I think it would be very nice if we had this option in the entity reference formatter, enabled by default to still show links so that it doesn't affect existing formatters.

CommentFileSizeAuthor
#1 1781272-disable-links.patch2.44 KBdave reid

Comments

dave reid’s picture

Status: Active » Needs review
StatusFileSize
new2.44 KB

Patch attached for review.

kaizerking’s picture

how about providing reference applicability for "view mode"?
ex:links available only on teaser or full mode or any custom mode issue here reference a view mode

amitaibu’s picture

Status: Needs review » Fixed
+++ b/entityreference.moduleundefined
@@ -1023,7 +1032,13 @@ function entityreference_field_formatter_view($entity_type, $entity, $field, $in
+        if (empty($settings['links'])) {
+          if (isset($result[$delta][$field['settings']['target_type']][$item['target_id']]['links'])) {

I've unified this into a single IF, and committed. Thanks.

dave reid’s picture

Status: Fixed » Needs work

Ack, I also just found a small typo:

+    $summary[] = !empty($settigs['links']) ? t('Display links') : t('Do not display links');

Should be $settings. At least it only affects the formatter summary. :/

amitaibu’s picture

Status: Needs work » Fixed

Fixed the typo.

Status: Fixed » Closed (fixed)

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

fozzy’s picture

Sorry but (for me at least) doesn't seem to work.

Wether I check or uncheck the 'Show links' checkbox, links always appear (despite 'Do not display links' summary)...

aprohl5’s picture

I would like to second fozzy on this one. I can and uncheck and check the show links checkbox a thousand times and nothing seems to change. I believe that my links will display eternally.

aprohl5’s picture

I would now like to rescind my previous statement by saying I do not know what a link is. I was looking at the entity title. My apologies Mr. Reid.