'Views Tabs', 'page callback' => 'drupal_get_form', 'page arguments' => array('views_tabs_admin_settings'), 'access arguments' => array('administer site configuration'), 'type' => MENU_LOCAL_TASK, ); return $items; } /** * Administration settings form. */ function views_tabs_admin_settings() { $form = array(); $options = array('0' => t('none')) + drupal_map_assoc(array(10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140, 160, 180, 200)); $form['views_tabs_truncate_length'] = array( '#type' => 'select', '#title' => t('Maximum length of tab titles'), '#default_value' => variable_get('views_tabs_truncate_length', 0), '#options' => $options, '#description' => t('Views presented on tabs use content titles for the tab titles. You can limit the length of these tab titles by selecting a maximum length here. Titles will be cut (truncated) to the nearest word. Choose "none" to display full titles.'), ); return system_settings_form($form); } /** * Display the nodes of a view on tabs. */ function theme_views_tabs_display($view, $nodes, $type, $teasers = FALSE, $links = TRUE) { // $fields = _views_get_fields(); $tabset = array( '#type' => 'tabset', ); foreach ($nodes as $node) { switch ($view->type) { case 'tabs_fields': $item = ''; foreach ($view->field as $field) { if ($fields[$field['id']]['visible'] !== FALSE) { if ($field['label']) { $item .= "
" . $field['label'] . "
"; } $item .= "
" . views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view) . "
"; } } $title = check_plain($node->node_title); $content = "
name) ."'>$item
\n"; break; case 'tabs_teaser': case 'tabs_node': $node = node_load($node->nid); $content = node_view($node, $teasers, FALSE, $links); $title = check_plain($node->title); break; } if ($length = variable_get('views_tabs_truncate_length', 0)) { $title = truncate_utf8($title, $length, TRUE, TRUE); } $tabset[$title] = array( '#type' => 'tabpage', '#content' => $content, '#title' => $title, ); } if (element_children($tabset)) { return tabs_render($tabset); } } function views_tabs_display_theme() { return array( 'views_tabs_display_format' => array( 'arguments' => array('view', 'nodes', 'type', 'teasers', 'links'), ), ); } function views_tabs_views_api() { return array( 'api' => 2, 'path' => drupal_get_path('module', 'views_tabs') .'/includes', ); }