You are here

class field_collection_views_handler_field_edit_link in Field Collection Views 8

Same name and namespace in other branches
  1. 7 views/field_collection_views_handler_field_edit_link.inc \field_collection_views_handler_field_edit_link

Field handler to present a link node edit.

Hierarchy

Expanded class hierarchy of field_collection_views_handler_field_edit_link

1 string reference to 'field_collection_views_handler_field_edit_link'
field_collection_views_views_data in views/field_collection_views.views.inc
Implements hook_views_data()

File

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

View source
class field_collection_views_handler_field_edit_link extends field_collection_views_handler_field_field_path {

  /**
   * Renders the link.
   */
  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;
  }

}

Members