How can i use (ONLY) Add link for a field_collection field within a view?
I have no success either to display with fieled collection data list (or view).

Comments

tim.plunkett’s picture

Status: Active » Postponed
vasike’s picture

Status: Postponed » Active

it seems that related issue it's already fixed but didn't fixed the present one.

mrfelton’s picture

Title: Add link for the field collection within a view » Add, Edit and View link for the field collection within a view
Category: support » feature

Also need views field handlers for Add, Edit, and Delete fields - that should only show based on user permissions.

mrfelton’s picture

Title: Add, Edit and View link for the field collection within a view » Views field handlers for field collection 'action' links
Status: Active » Needs review
StatusFileSize
new4.09 KB

Attached patch adds new views handlers that provide Edit and Delete links for field collection items.

mrfelton’s picture

Fix whitespace issues.

jerdavis’s picture

StatusFileSize
new6.07 KB

Here is a different approach which more closely follows what Views itself is doing for similar action links for Nodes.

bulldozer2003’s picture

Status: Needs review » Reviewed & tested by the community

Thank you!

Another note is that you should not create a label in views for the links as the label will be shown to unprivileged users while the link is properly hidden.

bulldozer2003’s picture

If you are only displaying a single node's field collection items, another tip is to exclude the add item link from display. Then add a footer with the following global unfiltered text with "use replacement patterns" checked.

<ul class="action-links">
<li>[add_item]</li>
</ul>

If you don't exclude add item from display, it will be displayed in every field collection item.

fago’s picture

Status: Reviewed & tested by the community » Needs work

Those handlers should leverage the views' views_handler_field_enttiy (or how it is called), such as the node links do in View. Check them for example.

I do no think we should directly extend the node-link handlers. Semantically it doesn't make sense and I don't think it would bring us much.

jerdavis’s picture

@Fago #6 doesn't extend the node link handlers, did you take a look at it?

roam2345’s picture

Reroll against latest dev.

mrfelton’s picture

Status: Needs work » Needs review
StatusFileSize
new6.11 KB

Patch from #6 updated against dev again

chris matthews’s picture

The patch in #12 no longer applies to the latest 7.x-1.x-dev and may be too old to easily reroll, but I went ahead and tagged the issue accordingly.

Checking patch field_collection.info...
error: while searching for:
files[] = field_collection.test
files[] = field_collection.info.inc
files[] = views/field_collection_handler_relationship.inc
files[] = field_collection.migrate.inc
configure = admin/structure/field-collections
package = Fields

error: patch failed: field_collection.info:5
error: field_collection.info: patch does not apply
Checking patch views/field_collection.views.inc...
Hunk #1 succeeded at 60 (offset 4 lines).
Checking patch views/field_collection_handler_field_link.inc...
Checking patch views/field_collection_handler_field_link_add.inc...
Checking patch views/field_collection_handler_field_link_delete.inc...
Checking patch views/field_collection_handler_field_link_edit.inc...