1

I have created a membership based website in Drupal 7. I want the user should create his portfolio and upload his work images. So i created a content type called portfolio having image field with unlimited upload option and gave access to that role. Also i want the user to like other user's images. So i created a View in which all portfolio images displays. For like button, i used Flag module.

Now problem is, there is only option Node Flag in views that shows flag only on 1st image in that node. I want flag on each image field in views like Facebook. So technically user should create multiple nodes if flag need to appear on each image. But its very much complex. Is there any way to add flag on each field in content in views?

1
  • Hello @Pranav P, how your issue getting along? Any updates? Apr 7, 2016 at 17:38

3 Answers 3

2

I am gonna say something different than @Volker, hopefully correct.

Important: You need to install the File Entity module to allow flags on your image field's multiple values.

Just tried this and it works for me, using:

  • A multivalued Image field; setting its display "Format" to "Rendered file" and the "View mode" to "Teaser", here is a screenshot of my configuration: enter image description here
  • A new Flag for File entities; selecting the respective "Display in entity links" view modes. Selecting is optional, it should work out of the box.

And there is what I get:

enter image description here

Hope this helps!

4
  • Oh! Very cool! Upvoted!
    – Volker
    Mar 30, 2016 at 12:16
  • Hi Stefanos Petrakis Can you please provide Views settings? I tried with your instructions, but the image is displayed as a file and not as image. Also i created a flag as File entity, but its not showing in views.
    – Pranav P
    Mar 31, 2016 at 4:46
  • Hello @Pranav P, I am not using the Views module, just the standard Display management of a content type. I will update my answer above with more details. Mar 31, 2016 at 8:22
  • Forgot to mention the use of the File Entity module, added it above, as well as a screenshot, let me know how this works out! Mar 31, 2016 at 8:31
0

AFAIK at the moment with flag module and views this isn't possible (see https://www.drupal.org/node/1024536) because multivalue-fields aren't identifiable with an ID. There's probably a workaround using the Field-Collection module for this as individual field-items are entities. For easy upload you could use Field Collection Bulkupload.

0

In views you can create a filter for the flagged images:

  1. add a relation to the image:fid
  2. add a relation to the flag: image
  3. add a flag filter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.