I have created a view of profile2 data, somekind like a extended user profile where users can add some personal data and other information of interest. I chose the view because in a next step of development I want to provide a profile search function. Basically I think to choose a View is the right way to go.

So when I (as a owner of a profile) call the view page (filter is set to my login UID, setup as a contextual filter) it shows up and the editable defined fields are all editable (by click). I wanted to provide a profile page view that is in-page editable (eg. functions as a form and a view, all in one). All this works great. Also I can use that view to show to anonymous users (as a search result) the profile content (non editable of course).

My problem are 2 field-collections in that profile that shows (due to the editable setting "Formatter" in the View field definition) both the "add" link and also the "edit this field" of the "editable setting" of these very 2 fields. That is redundant. I seem not to be able to find any way to switch off the second "edit this field" link. If I set these field-collections to the "default" formatter (not editable), I also get no "add" link to add values to the field collections. This is the case if the user just created an account and the collections are empty.

Now my question, how can I remove the "edit this field" link generated by the "editable" functionality? It seems, that JS add these links and I can not remove them anyhow. Is there any way I can override these two fields and remove the link (but still leave these fields in editable state)? Some theme override I could use, or somewhere within the fields template?

I played a little and defined a field template (named by the collection-field such as views-view-field--field-work-experience.tpl.php) and tried to remove the 'edit this link" or JS selector. If I now choose the formatter editable-link, (not the editable formatter) and change the code in the field template to

$markup = $row->field_field_work_experience[0]['rendered']['#markup'];
print $markup;

the "edit this field" from the editable-link module will not show up, but I get the wanted "add" link. The regular field template output

print $output;

will show both, the "add" link and the "edit this field" link.

Well, the first snippet is a dirty hack and a try and it might lead to undefined behavior. I do not like to keep up with that at all.

BTW, I have both modules installed, "editable-link" and "editable". I develop with drupal 7.

So is there any way I can remove these "editable field" links from the field-collection fields and just get the regular link "add".

I hope I described my problem clear enough, if not please let me know I try to explain more precisely.

Any help is greatly appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.