You are here

function field_collection_views_handler_field_edit_link::render_link in Field Collection Views 7

Same name and namespace in other branches
  1. 8 views/field_collection_views_handler_field_edit_link.inc \field_collection_views_handler_field_edit_link::render_link()

Renders the link.

File

views/field_collection_views_handler_field_edit_link.inc, line 17
Definition of field_collection_views_handler_field_edit_link.

Class

field_collection_views_handler_field_edit_link
Field handler to present a link node edit.

Code

function render_link($field_collection_item, $values) {

  // Ensure user has access to edit this field collection.
  if (!field_collection_item_access('update', $field_collection_item)) {
    return;
  }
  $field_path = field_collection_field_get_path($field_collection_item
    ->fieldInfo());

  //?destination=[host_entity_path]
  $this->options['alter']['make_link'] = TRUE;
  $this->options['alter']['path'] = "{$field_path}/{$field_collection_item->item_id}/edit";
  $this->options['alter']['query'] = drupal_get_destination();
  $text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
  return $text;
}