From ea53aad7c8ced499e397cbedfe1e0cce205c071f Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 3 Nov 2005 19:33:37 +0000 Subject: - Patch #22215 by Richard Archer: refactored primary and secondary links. Deprecates the primary_links module. This patch was much needed. Thanks Richards! NOTE: if some themers could investigate if there is room for improvement with regard to theming, that would be awesome. --- modules/system.module | 63 --------------------------------------------------- 1 file changed, 63 deletions(-) (limited to 'modules/system.module') diff --git a/modules/system.module b/modules/system.module index 9fa32b0a0..6454945ec 100644 --- a/modules/system.module +++ b/modules/system.module @@ -1043,11 +1043,6 @@ function system_theme_settings($key = '') { // System wide only settings. if (!$key) { - // Menu settings - - $form['primary_links'] = system_navigation_links_form('primary', 'Primary'); - $form['secondary_links'] = system_navigation_links_form('secondary', 'Secondary'); - // Toggle node display. $node_types = module_invoke('node', 'get_types'); if ($node_types) { @@ -1066,8 +1061,6 @@ function system_theme_settings($key = '') { 'toggle_name' => t('Site name'), 'toggle_slogan' => t('Site slogan'), 'toggle_mission' => t('Mission statement'), - 'toggle_primary_links' => t('Primary links'), - 'toggle_secondary_links' => t('Secondary links'), 'toggle_node_user_picture' => t('User pictures in posts'), 'toggle_comment_user_picture' => t('User pictures in comments'), 'toggle_search' => t('Search box'), @@ -1117,62 +1110,6 @@ function system_theme_settings($key = '') { } -function system_navigation_links_form($type, $utype) { - $settings = theme_get_settings(''); - $value = $settings[$type . '_links']; - - if (!is_array($value)) { - $value = array(); - } - // Increment the link count, if the user has requested more links. - if (variable_get($type . '_links_more', false)) { - variable_del($type . '_links_more'); - variable_set($type . '_link_count', variable_get($type . '_link_count', 5) + 5); - } - - // Get the amount of links to show, possibly expanding if there are more links defined than the count specifies. - $count = variable_get($type . '_link_count', 5); - $count = ($count > sizeof($value['link'])) ? $count : sizeof($value['link']); - - if (variable_get($type . '_link_count', 5) != $count) { - variable_set($type . '_link_count', $count); - } - $form = array( - '#type' => 'item', '#title' => t('_TYPE_ link settings', array('_TYPE_' => $utype)), '#theme' => 'system_navigation_links_form', - '#description' => t('You can specify your _TYPE_ links here, one link per line.
The link text field is the text you want to link.
The url field is the location the link points to.
The description field is an optional description of where the link points.', array('_TYPE_' => $type)) - ); - - $form['#tree'] = TRUE; - - for ($i = 0; $i < $count; $i++) { - foreach (array('text', 'link', 'description') as $field) { - $form[$field][$i] = array('#type' => 'textfield', '#default_value' => $value[$field][$i], '#size' => 15, '#maxlength' => 90); - } - } - - $form[$type . '_links_more'] = array( - '#type' => 'checkbox', '#title' => t('I need more _TYPE_ links.', array('_TYPE_' => $type)), '#default_value' => FALSE, - '#description' => t('Checking this box will give you 5 additional _TYPE_ links.', array('_TYPE_' => $type)) - ); - return $form; -} - -function theme_system_navigation_links_form(&$form) { - $header = array(t('link text'), t('url'), t('description')); - foreach (element_children($form['text']) as $key) { - $row = array(); - $row[] = form_render($form['text'][$key]); - $row[] = form_render($form['link'][$key]); - $row[] = form_render($form['description'][$key]); - $rows[] = $row; - - } - $output = theme('table', $header, $rows); - $output .= form_render($form); - return $output; -} - - function search_box() { $form['#action'] = url('search'); $form['keys'] = array('#type' => 'textfield', '#size'=> 15, '#value' => '', '#attributes' => array('alt' => t('Enter the terms you wish to search for.'), 'class' => 'form-text')); -- cgit v1.2.3