How do I add the edit link of a content in a custom view mode? I have a content type (Sample) which includes a field (A) whose widget type is View. I'm using the Entity Reference View Widget View module for this. 

The output of this field is having only the title of the node added from the view, but I want also the Node Edit link.

As far as I know, the output of Entiy Reference View Widget View can be printed with any custom view mode. I'm trying to add the node edit link in this custom view mode. 

Do you have any idea on how to add a custom field having the edit link in the view mode?The steps which i followed are:

Step 1:I selected the particular view mode in the content type field settings A:
Here is the screen shot:



Step 2: In Display suit fields(admin/structure/ds/fields) i have added custom edit link field like &lt;a href="node/edit/[node:nid]"&gt;Edit&lt;/a&gt; 
I can see Edit link in the output ,but the  token value i provided [node:nid] is not fetching the node id. Link is redirecting to node/edit/%5Bnode%3Anid%5D .Can anybody help me in this? Please the below screenshot
 

Correct me if i'm wrong.
Any other approach or method is also fine.
You can enable views_ui in module page, then go to structure/views and edit the views you are using for the widget. Add Content: Edit link in fields and save it. It will got the edit links for each entity as above image.



Override theme function by custom module

There is no easy way to add the edit link for the widget on node page. But you can still make it happen by overriding the theme functions provided by Entity Reference View Widget View



Below is the sample snippet with assuming the name of your custom module is mymodule. You can copy and paste it into a custom module for testing. (Remember to change the mymodule if you have different name for your custom module.)

&lt;?php

/**
 * Implements hook_theme_registry_alter().
 */
function mymodule_theme_registry_alter(&amp;$theme_registry) {
  if (isset($theme_registry['entityreference_view_widget_widget']['function'])) {
    $theme_registry['entityreference_view_widget_widget']['function'] = 'mymodule_entityreference_view_widget_widget';
  }
  if (isset($theme_registry['entityreference_view_widget_rows']['function'])) {
    $theme_registry['entityreference_view_widget_rows']['function'] = 'mymodule_entityreference_view_widget_rows';
  }
} 

/**
 * Override theme_entityreference_view_widget_widget().
 */
function mymodule_entityreference_view_widget_widget($variables) {
  $widget = $variables['widget'];
  $settings = $widget['add_more']['#ervw_settings'];
  $order_class = drupal_html_class($settings['element'] . '-delta-order');
  $required = !empty($settings['instance']['required']) ? theme('form_required_marker', $variables) : '';

  $header = array(
    array(
      'data' =&gt; '&lt;label&gt;' . t('!title !required', array('!title' =&gt; $widget['#title'], '!required' =&gt; $required)) . "&lt;/label&gt;",
      'colspan' =&gt; 2,
      'class' =&gt; array('field-label'),
    ),
  );
  $header[] = array(
    'data' =&gt; "&lt;label&gt;" . t('Edit link') . "&lt;/label&gt;",
    'class' =&gt; array('field-label'),
  );
  if ($settings['field']['cardinality'] !== '1') {
    $header[] = array(
      'data' =&gt; t('Order'),
      'class' =&gt; array('tabledrag-hide'),
    );
  }
  $rows = array();

  // Sort items according to '_weight' (needed when the form comes back after
  // preview or failed validation)
  $items = array();
  foreach (element_children($widget) as $key) {
    if ($key === 'add_more') {
      $add_more_button = &amp;$widget[$key];
    }
    else {
      $items[] = &amp;$widget[$key];
    }
  }
  usort($items, '_field_sort_items_value_helper');

  // Add the items as table rows.
  foreach ($items as $item) {
    $item['_weight']['#attributes']['class'] = array($order_class);
    $delta_element = drupal_render($item['_weight']);

    $cells = array(
      array('data' =&gt; '', 'class' =&gt; array('field-multiple-drag')),
      drupal_render($item),
    );

    $target_id = $item['target_id']['#return_value'];
    $entities = entity_load($settings['target_type'], array($target_id));
    $cells[] = array(
      'data' =&gt; _mymodule_entity_edit_link($settings['target_type'], $entities[$target_id]),
    );

    if ($settings['field']['cardinality'] !== '1') {
      $cells[] = array('data' =&gt; $delta_element, 'class' =&gt; array('delta-order'));
    }
    $rows[] = array(
      'data' =&gt; $cells,
      'class' =&gt; array('draggable'),
    );
  }

  if (empty($rows)) {
    $rows[][] = array(
      'data' =&gt; t('No items have been added yet. Click "Add items" to launch the widget.'),
      'colspan' =&gt; '3',
    );
  }

  $output = '&lt;div class="form-item"&gt;';
  $form_errors = form_get_errors();
  $classes = array('field-multiple-table');

  // Add an error class to the table in case of error.
  if (isset($form_errors[$settings['element']])) {
    $classes[] = 'error';
  }

  $output .= theme('table', array(
    'header' =&gt; $header,
    'rows' =&gt; $rows,
    'attributes' =&gt; array(
      'id' =&gt; $settings['table_id'],
      'class' =&gt; $classes,
    ),
  ));
  $output .= $widget['#description'] ? '&lt;div class="description"&gt;' . $widget['#description'] . '&lt;/div&gt;' : '';
  $output .= '&lt;div class="clearfix"&gt;' . drupal_render($add_more_button) . '&lt;/div&gt;';
  $output .= '&lt;/div&gt;';

  if ($settings['field']['cardinality'] !== '1') {
    drupal_add_tabledrag($settings['table_id'], 'order', 'sibling', $order_class);
  }

  return $output;
}

/**
 * Override theme_entityreference_view_widget_rows().
 */
function mymodule_entityreference_view_widget_rows($variables) {
  $zebra = array('even' =&gt; 'odd');

  $settings = $variables['rows']['#widget_settings'];
  foreach (element_children($variables['rows']) as $row) {
    $output[$row]  = '&lt;tr class="draggable ' . current($zebra) . '"&gt;';
    $output[$row] .= '&lt;td class="field-multiple-drag"&gt;&lt;/td&gt;';
    $output[$row] .= '&lt;td&gt;' . render($variables['rows'][$row][$settings['column']]) . '&lt;/td&gt;';

    $target_id = $variables['rows'][$row]['target_id']['#return_value'];
    $entities = entity_load($settings['target_type'], array($target_id));
    $output[$row] .= '&lt;td&gt;' . _mymodule_entity_edit_link($settings['target_type'], $entities[$target_id]) . '&lt;/td&gt;';

    if ($settings['cardinality'] !== '1') {
      $output[$row] .= '&lt;td class="delta-order tabledrag-hide"&gt;' . render($variables['rows'][$row]['_weight']) . '&lt;/td&gt;';
    }
    $output[$row] .= '&lt;/tr&gt;';

    $zebra = array_flip($zebra);
  }

  return implode("\n", $output);
}

/**
 * Helper function to build the entity edit link.
 */
function _mymodule_entity_edit_link($entity_type, $entity) {
  $uri = entity_uri($entity_type, $entity);
  return l(t('Edit'), $uri['path'] . '/edit');
}


The key concept here is programmatically override the 2 theme functions with hook_theme_registry_alter:


theme_entityreference_view_widget_widget()
theme_entityreference_view_widget_rows()


So we can now modify the table output.

Add a new column header

$header[] = array(
  'data' =&gt; "&lt;label&gt;" . t('Edit link') . "&lt;/label&gt;",
  'class' =&gt; array('field-label'),
);


Add link for new column

For static output.

$target_id = $item['target_id']['#return_value'];
$entities = entity_load($settings['target_type'], array($target_id));
$cells[] = array(
  'data' =&gt; _mymodule_entity_edit_link($settings['target_type'], $entities[$target_id]),
);


For dynamic output. (ajax callback)

$target_id = $variables['rows'][$row]['target_id']['#return_value'];
$entities = entity_load($settings['target_type'], array($target_id));
$output[$row] .= '&lt;td&gt;' . _mymodule_entity_edit_link($settings['target_type'], $entities[$target_id]) . '&lt;/td&gt;';


Helper function to build edit link

/**
 * Helper function to build the entity edit link.
 */
function _mymodule_entity_edit_link($entity_type, $entity) {
  $uri = entity_uri($entity_type, $entity);
  return l(t('Edit'), $uri['path'] . '/edit');
}