3.0, ); } /** * Implemets hook_menu(). * Adds menu items for the tripal_contact module menu. This section * gives the outline for the main menu of the Tripal-contact module * * @return * An array of menu items that is visible within the Drupal Menu, returned as soon * as the program is ran * * @ingroup tripal_contact */ function tripal_contact_menu() { $items = array(); $items['admin/tripal/chado/tripal_contact']= array( 'title' => 'Contacts', 'description' => ('Model persons, institutes, groups, organizations, etc.'), 'page callback' => 'tripal_contact_admin_contact_view', 'access arguments' => array('administer tripal contact'), 'type' => MENU_NORMAL_ITEM ); $items['admin/tripal/chado/tripal_contact/configuration'] = array( 'title' => 'Settings', 'description' => 'Integration of Chado contacts.', 'page callback' => 'drupal_get_form', 'page arguments' => array('tripal_contact_admin'), 'access arguments' => array('administer tripal contact'), 'type' => MENU_LOCAL_TASK, 'weight' => 5 ); $items['admin/tripal/chado/tripal_contact/help']= array( 'title' => 'Help', 'description' => ('Help with the contact module.'), 'page callback' => 'theme', 'page arguments' => array('tripal_contact_help'), 'access arguments' => array('administer tripal contact'), 'type' => MENU_LOCAL_TASK, 'weight' => 10 ); $items['admin/tripal/chado/tripal_contact/sync'] = array( 'title' => ' Sync', 'description' => 'Sync contacts in Chado with Drupal', 'page callback' => 'drupal_get_form', 'page arguments' => array('tripal_contact_sync_form'), 'access arguments' => array('administer tripal contact'), 'type' => MENU_LOCAL_TASK, 'weight' => 0 ); $items['admin/tripal/chado/tripal_contact/sync'] = array( 'title' => ' Sync', 'description' => 'Create pages on this site for libraries stored in Chado', 'page callback' => 'drupal_get_form', 'page arguments' => array('chado_node_sync_form', 'tripal_contact', 'chado_contact'), 'access arguments' => array('administer tripal contact'), 'type' => MENU_LOCAL_TASK, 'weight' => 2 ); return $items; } /** * Implements hook_search_biological_data_views(). * * Adds the described views to the "Search Biological Data" Page created by Tripal Views */ function tripal_contact_search_biological_data_views() { return array( 'tripal_contact_user_contacts' => array( 'machine_name' => 'tripal_contact_user_contacts', 'human_name' => 'Contacts', 'description' => 'Information about persons, institutes, groups, organizations, etc.', 'link' => 'chado/contact' ), ); } /** * Implements hook_theme(). * Register themeing functions for this module * * @return * An array of themeing functions to register * * @ingroup tripal_contact */ function tripal_contact_theme($existing, $type, $theme, $path) { $core_path = drupal_get_path('module', 'tripal_core'); $items = array( 'node__chado_contact' => array( 'template' => 'node--chado-generic', 'render element' => 'node', 'base hook' => 'node', 'path' => "$core_path/theme", ), 'tripal_contact_base' => array( 'variables' => array('node' => NULL), 'template' => 'tripal_contact_base', 'path' => "$path/theme/tripal_contact", ), 'tripal_contact_properties' => array( 'variables' => array('node' => NULL), 'template' => 'tripal_contact_properties', 'path' => "$path/theme/tripal_contact", ), 'tripal_contact_relationships' => array( 'variables' => array('node' => NULL), 'template' => 'tripal_contact_relationships', 'path' => "$path/theme/tripal_contact", ), 'tripal_contact_publications' => array( 'variables' => array('node' => NULL), 'template' => 'tripal_contact_publications', 'path' => "$path/theme/tripal_contact", ), 'tripal_contact_help' => array( 'template' => 'tripal_contact_help', 'variables' => array(NULL), 'path' => "$path/theme", ), 'tripal_contact_teaser' => array( 'variables' => array('node' => NULL), 'template' => 'tripal_contact_teaser', 'path' => "$path/theme/tripal_contact", ), ); return $items; } /** * Implements hook_block_info(). * * @ingroup tripal_contact */ function tripal_contact_block_info() { $blocks['contbase']['info'] = t('Tripal Contact Details'); $blocks['contbase']['cache'] = 'DRUPAL_NO_CACHE'; $blocks['contprops']['info'] = t('Tripal Contact Properties'); $blocks['contprops']['cache'] = 'DRUPAL_NO_CACHE'; $blocks['contrels']['info'] = t('Tripal Contact Relationships'); $blocks['contrels']['cache'] = 'DRUPAL_NO_CACHE'; $blocks['contpubs']['info'] = t('Tripal Contact Publications'); $blocks['contpubs']['cache'] = 'DRUPAL_NO_CACHE'; return $blocks; } /** * Implements hook_block_view(). * @ingroup tripal_contact */ function tripal_contact_block_view($delta = '') { if (user_access('access chado_contact content') and arg(0) == 'node' and is_numeric(arg(1))) { $nid = arg(1); $node = node_load($nid); $block = array(); switch ($delta) { case 'contbase': $block['subject'] = t('Overview'); $block['content'] = array( '#theme' => 'tripal_contact_base', '#nodes' => $node, '#title' => '', ); break; case 'contprops': $block['subject'] = t('Properties'); $block['content'] = array( '#theme' => 'tripal_contact_properties', '#nodes' => $node, '#title' => '', ); break; case 'contrels': $block['subject'] = t('Relationships'); $block['content'] = array( '#theme' => 'tripal_contact_relationships', '#nodes' => $node, '#title' => '', ); break; case 'contpubs': $block['subject'] = t('Publications'); $block['content'] = array( '#theme' => 'tripal_contact_publications', '#nodes' => $node, '#title' => '', ); break; default : } return $block; } } /** * Implement hook_permission(). * * @ingroup tripal_contact */ function tripal_contact_permission() { return array( 'access chado_contact content' => array( 'title' => t('View Contacts'), 'description' => t('Allow users to view contact pages.'), ), 'create chado_contact content' => array( 'title' => t('Create Contacts'), 'description' => t('Allow users to create new contact pages.'), ), 'delete chado_contact content' => array( 'title' => t('Delete Contacts'), 'description' => t('Allow users to delete contact pages.'), ), 'edit chado_contact content' => array( 'title' => t('Edit Contacts'), 'description' => t('Allow users to edit contact pages.'), ), 'adminster tripal contact' => array( 'title' => t('Administer Contacts'), 'description' => t('Allow users to administer all contacts.'), ), ); } /** * Implementation of hook_form_alter(). * * @ingroup tripal_contact */ function tripal_contact_form_alter(&$form, &$form_state, $form_id) { if ($form_id == "chado_contact_node_form") { // turn of preview button for insert/updates $form['actions']['preview']['#access'] = FALSE; //remove the body field unset($form['body']); } }