You are here

function references_dialog_term_reference_add_link in References dialog 7

Add link callback for term references.

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

File

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

Code

function references_dialog_term_reference_add_link($element, $widget_settings, $field, $instance) {
  $vocabulary = $field['settings']['allowed_values'][0]['vocabulary'];
  $add_links = array();
  if (user_access('administer taxonomy') || module_exists('taxonomy_access_fix') && taxonomy_access_fix_access('add terms', $vocabulary)) {
    $add_links[] = array(
      'title' => t('Create @type', array(
        '@type' => taxonomy_vocabulary_machine_name_load($vocabulary)->name,
      )),
      'href' => 'admin/structure/taxonomy/' . $field['settings']['allowed_values'][0]['vocabulary'] . '/add',
    );
  }
  return $add_links;
}