If you configure the field-collection module as a hidden field type, and use views to display the field-collection data. You'll find out that you don't have a way for editing and deleting field-collection data.

So if we expose field-collection "operational links" to views, then we'll be able to display that field in our view. Then the administrative staff can manage the field-collection data. Thoughts?

Comments

droath’s picture

Status: Active » Needs review
StatusFileSize
new4.01 KB

First time working with the Views API. :) Suggestions welcomed...

fago’s picture

Status: Needs review » Needs work

I think each link should be exposed on its own. Then we should make use of the recently added views_handler_field_entity to ensure we are getting real entity objects.

Also, we might want to look into exposing them automatically with the entity api? For that we would have to improve it to allow modules to specify the edit and delete urls somehow.

blackandcode’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
aaronbauman’s picture

Here's a quick and dirty re-roll of #1 that works for me against latest dev.
It would be even awesomer if we could somehow make this work with views' Global: Contextual Links handler.

aaronbauman’s picture

Status: Needs work » Needs review

OK, here's a much better patch, imo

  • implemented "crud info", similar to the discussion going on in entity api:
    #1333870-14: Add links to entity views integration
  • added views handler "field_collection_handler_field_url.inc" that extends "views_handler_field_url"
  • exposed crud fields to views through field_collection_field_views_data()

In conjunction with this patch: #1638074: views_handler_field_url is not compatible with views_handler_field_contextual_links, these urls will work with gracefully with contextual links. (as it stands, they'll still work, but you'll have to play with rewriting the output of the field).

Status: Needs review » Needs work
aaronbauman’s picture

Status: Needs work » Needs review
StatusFileSize
new3.73 KB

... and the patch

Status: Needs review » Needs work

The last submitted patch, field_collection-view_urls-1309332-5.patch, failed testing.

aaronbauman’s picture

Status: Needs work » Needs review
StatusFileSize
new3.93 KB

fargle bargle testbot

Status: Needs review » Needs work

The last submitted patch, field_collection-view_urls-1309332-10.patch, failed testing.

aaronbauman’s picture

this is a good patch.
i give up.

danylevskyi’s picture

Status: Needs work » Needs review
StatusFileSize
new5.33 KB

Hi guys!

First of all I want to thank fago for this beautiful module and thank you guys for your patches!
Here is updated patch:

  1. Handler extends new views_handler_field_entity handler as fago proposed.
  2. Added permission checks.
  3. Also I have removed view and add links. I think they are unnecessary here.

Status: Needs review » Needs work

The last submitted patch, 13: field_collection-views_links-1309332-13.patch, failed testing.

socialnicheguru’s picture

Issue summary: View changes
aaronbauman’s picture

Status: Needs work » Closed (duplicate)
Parent issue: » #1257274: Views field handlers for field collection 'action' links

Seems like a dupe, and the other issue is passing tests.