You are here

function references_dialog_term_reference_edit_link in References dialog 7

Edit link callback for term references.

1 string reference to 'references_dialog_term_reference_edit_link'
references_dialog_references_dialog_widgets in ./references_dialog.dialog_widgets.inc
Implements hook_references_dialog_widgets().

File

./references_dialog.dialog_widgets.inc, line 364
Implements dialogs for node reference and user reference fields.

Code

function references_dialog_term_reference_edit_link($element, $widget_settings, $field, $instance) {
  if (isset($element['#default_value'])) {

    // Get Term ID from entity.
    $term = taxonomy_term_load($element['#entity']->{$element['#field_name']}[$element['#language']][$element['#delta']]['tid']);
    if ($term && taxonomy_term_edit_access($term)) {
      $path = taxonomy_term_uri($term);
      return array(
        array(
          'title' => t('Edit'),
          'href' => $path['path'] . '/edit',
        ),
      );
    }
  }
  return array();
}