1.20.x taxonomy.admin.inc _vocabulary_get_operations($vocabulary)

Given a vocabulary, return a list of operations that can be performed on it.

File

modules/taxonomy/taxonomy.admin.inc, line 75
Admin page callbacks for the Taxonomy module.

Code

function _vocabulary_get_operations($vocabulary) {
  $links = array();

  // Allow access to the terms listing for the vocabulary if the user has:
  // - any of the create/update (edit)/delete permissions,
  // - or the the 'administer taxonomy' permission.
  if (taxonomy_vocabulary_access(FALSE, $vocabulary)) {
    $links['list'] = array(
      'title' => t('List terms'),
      'href' => 'admin/structure/taxonomy/' . $vocabulary->machine_name,
    );
  }
  if (taxonomy_vocabulary_access('create', $vocabulary)) {
    $links['add'] = array(
      'title' => t('Add terms'),
      'href' => 'admin/structure/taxonomy/' . $vocabulary->machine_name . '/add',
    );
  }
  if (user_access('administer taxonomy')) {
    $links['configure'] = array(
      'title' => t('Configure'),
      'href' => 'admin/structure/taxonomy/' . $vocabulary->machine_name . '/configure',
    );
  }
  if (module_exists('field_ui') && user_access('administer fields')) {
    $links['fields'] = array(
      'title' => t('Manage fields'),
      'href' => 'admin/structure/taxonomy/' . $vocabulary->machine_name . '/fields',
      'weight' => 5,
    );
    $links['display'] = array(
      'title' => t('Manage displays'),
      'href' => 'admin/structure/taxonomy/' . $vocabulary->machine_name . '/display',
      'weight' => 10,
    );
  }
  if (user_access('synchronize configuration')) {
    $links['export'] = array(
      'title' => t('Export'),
      'href' => 'admin/config/development/configuration/single/export',
      'query' => array(
        'group' => 'Vocabularies',
        'name' => 'taxonomy.vocabulary.' . $vocabulary->machine_name,
      ),
    );
  }
  if (user_access('administer taxonomy')) {
    $links['delete'] = array(
      'title' => t('Delete'),
      'href' => 'admin/structure/taxonomy/' . $vocabulary->machine_name . '/delete',
    );
  }

  return $links;
}