'Taxonomy Copier', 'description' => 'Configure Taxonomy Copier settings.', 'page callback' => 'drupal_get_form', 'page arguments' => array('taxonomy_tools_copier_admin_form'), 'access arguments' => array('access administration pages'), 'file' => 'taxonomy_tools_copier.admin.inc', 'file path' => drupal_get_path('module', 'taxonomy_tools_copier'), ); $items['admin/structure/taxonomy/%taxonomy_vocabulary_machine_name/copy/%'] = array( 'title callback' => 'taxonomy_tools_copier_title_callback', 'title arguments' => array(5), 'description' => 'Taxonomy copier term copying form.', 'page callback' => 'drupal_get_form', 'page arguments' => array('taxonomy_tools_copier_copy_form', 3, 5), 'file' => 'taxonomy_tools_copier.admin.inc', 'file path' => drupal_get_path('module', 'taxonomy_tools_copier'), 'access arguments' => array('use taxonomy copier'), ); $items['taxonomy-copier/%/nodes/%'] = array( 'title' => 'Term nodes', 'type' => MENU_CALLBACK, 'page callback' => 'taxonomy_tools_copier_nodes_ajax', 'page arguments' => array(1, 3), 'file' => 'taxonomy_tools_copier.admin.inc', 'file path' => drupal_get_path('module', 'taxonomy_tools_copier'), 'access arguments' => array('use taxonomy copier'), ); $items['taxonomy/term/%taxonomy_term/copy'] = array( 'title' => 'Copy', 'description' => 'Taxonomy copier term copying form.', 'page callback' => 'drupal_get_form', 'page arguments' => array('taxonomy_tools_copier_copy_form', NULL, 2), 'file' => 'taxonomy_tools_copier.admin.inc', 'file path' => drupal_get_path('module', 'taxonomy_tools_copier'), 'access arguments' => array('use taxonomy copier'), 'type' => MENU_LOCAL_TASK, 'weight' => 49, ); return $items; } /** * Returns the title for taxonomy term copying form. * * @param int $tid * Taxonomy term object or identificator. * * @return string * Title for the form. */ function taxonomy_tools_copier_title_callback($tid) { $query = db_select('taxonomy_term_data', 'foo'); $query->addField('foo', 'name'); $query->condition('foo.tid', $tid); $result = $query->execute()->fetchField(); $title = t('Copy taxonomy terms of @name branch', array('@name' => $result)); return $title; } /** * Implements hook_theme(). */ function taxonomy_tools_copier_theme() { return array( 'taxonomy_tools_copier_nodes_container' => array( 'render element' => 'container', ), 'taxonomy_tools_copier_nodes_list_container' => array( 'render element' => 'container', ), ); } /** * Implements hook_admin_paths(). */ function taxonomy_tools_copier_admin_paths() { $paths = array( 'taxonomy-copier/*' => TRUE, ); return $paths; } /** * Implements hook_taxonomy_tools_overview_links(). */ function taxonomy_tools_copier_taxonomy_tools_overview_links($tid) { $links = array(); $term = taxonomy_term_load($tid); $destination = drupal_get_destination(); $links['copy'] = array( '#type' => 'link', '#title' => '', '#href' => 'admin/structure/taxonomy/' . $term->vocabulary_machine_name . '/copy/' . $term->tid, '#attributes' => array( 'class' => array( 'copy-term', ), 'title' => t('copy'), ), '#options' => array( 'query' => array( 'destination' => $destination['destination'], ), ), '#access' => user_access('use taxonomy copier'), ); return $links; } /** * Implements hook_permission(). */ function taxonomy_tools_copier_permission() { return array( 'use taxonomy copier' => array( 'title' => t('Use Taxonomy Copier'), 'description' => t('Allows the user to make copies of existing taxonomy terms.'), ), ); }