/[drupal]/contributions/modules/page_title/page_title.module
ViewVC logotype

Diff of /contributions/modules/page_title/page_title.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.18.2.18, Sat Oct 31 16:15:58 2009 UTC revision 1.18.2.19, Sat Oct 31 22:18:54 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: page_title.module,v 1.18.2.17 2009/10/31 16:03:01 njt1982 Exp $  // $Id: page_title.module,v 1.18.2.18 2009/10/31 16:15:58 njt1982 Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 156  function page_title_form_alter(&$form, $ Line 156  function page_title_form_alter(&$form, $
156        );        );
157      }      }
158    }    }
159    // Check we're editing a user profile and also check that the user settings's have 'show field' enabled    // Check we're editing a forum container or forum "forum" and also check that the terms vocabulary's 'show field' is enabled
160      elseif ($form_id == 'forum_form_forum' || $form_id == 'forum_form_container') {
161        $key = 'page_title_vocab_'. $form['vid']['#value'] .'_showfield';
162        if (variable_get($key, 0)) {
163          $form['page_title'] = array(
164            '#type' => 'textfield',
165            '#title' => t('Page title'),
166            '#description' => t('Optionally specify a different title to appear in the &lt;title&gt; tag of the page.'),
167            '#default_value' => page_title_load_title($form['tid']['#value'], 'term'),
168            '#size' => 60,
169            '#maxlength' => 255,
170            '#weight' => -20,
171          );
172        }
173      }
174       // Check we're editing a user profile and also check that the user settings's have 'show field' enabled
175    elseif ($form_id == 'user_profile_form') {    elseif ($form_id == 'user_profile_form') {
176      if (variable_get('page_title_user_showfield', 0)) {      if (variable_get('page_title_user_showfield', 0)) {
177        $form['account']['page_title'] = array(        $form['account']['page_title'] = array(
# Line 198  function page_title_form_alter(&$form, $ Line 213  function page_title_form_alter(&$form, $
213    
214      $form['#submit'][] = 'page_title_node_type_form_submit';      $form['#submit'][] = 'page_title_node_type_form_submit';
215    }    }
216      elseif ($form_id == 'forum_admin_settings') {
217        $form['page_title'] = array(
218          '#type' => 'textfield',
219          '#title' => t('Page title'),
220          '#description' => t('Optionally specify a different title to appear in the &lt;title&gt; tag of the page.'),
221          '#default_value' => variable_get('page_title_forum_root_title', ''),
222          '#size' => 60,
223          '#maxlength' => 255,
224          '#weight' => -1,
225        );
226        $form['#submit'][] = 'page_title_forum_admin_settings_form_submit';
227      }
228    }
229    
230    
231    function page_title_forum_admin_settings_form_submit($form, &$form_state) {
232      variable_set('page_title_forum_root_title', $form_state['values']['page_title']);
233  }  }
234    
235    
# Line 316  function page_title_get_title() { Line 348  function page_title_get_title() {
348        $title = check_plain(strip_tags($term_title));        $title = check_plain(strip_tags($term_title));
349      }      }
350    }    }
351    // If we're looking at a taxonomy term page, get the term title    // If we're looking at a forum page determin if is a container/forum or the forum root
352    elseif (arg(0) == 'forum' && is_numeric(arg(1)) && module_exists('forum')) {    elseif (arg(0) == 'forum' && module_exists('forum')) {
353      $term = taxonomy_get_term(arg(1));      // If there is a number then its a container or forum
354      if (variable_get('page_title_vocab_'. $term->vid .'_showfield', 0) && ($term_title = page_title_load_title($term->tid, 'term'))) {      if (is_numeric(arg(1))) {
355        $title = check_plain(strip_tags($term_title));        $term = taxonomy_get_term(arg(1));
356          if (variable_get('page_title_vocab_'. $term->vid .'_showfield', 0) && ($term_title = page_title_load_title($term->tid, 'term'))) {
357            $title = check_plain(strip_tags($term_title));
358          }
359        }
360        // If not then it's the forum root.
361        else {
362          $title = variable_get('page_title_forum_root_title', '');
363      }      }
364    }    }
365    

Legend:
Removed from v.1.18.2.18  
changed lines
  Added in v.1.18.2.19

  ViewVC Help
Powered by ViewVC 1.1.2