Index: taxonomy_title.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_title/taxonomy_title.module,v retrieving revision 1.5 diff -u -r1.5 taxonomy_title.module --- taxonomy_title.module 29 Apr 2009 05:59:00 -0000 1.5 +++ taxonomy_title.module 18 Nov 2009 23:46:06 -0000 @@ -2,84 +2,82 @@ // $Id: taxonomy_title.module,v 1.5 2009/04/29 05:59:00 jenlampton Exp $ /** - * Implementation of hook_help() + * Implementation of hook_help(). */ function taxonomy_title_help($path, $arg) { - switch ($section) { + switch ($path) { case 'admin/content/taxonomy': - return t('

Set the page title on your Taxonomy pages.

'); + return '

' . t('Set the page title on your Taxonomy pages.') . '

'; + case 'admin/help#quiz': - return t('

Set the page title on your Taxonomy pages.

'); + return '

' . t('Set the page title on your Taxonomy pages.') . '

'; } } /** - * Implementation of hook_form_alter() + * Implementation of hook_form_FORM_ID_alter(). */ -function taxonomy_title_form_alter(&$form, &$form_state, $form_id){ - if ($form_id == 'taxonomy_form_term'){ - $title = _taxonomy_title_get_title($form['tid']['#value']); - $form['identification']['tax_title'] = array( - '#type' => 'textfield', - '#title' => t('Taxonomy Page Title'), - '#default_value' => $title, - '#description' => t('This is the title you will see on your taxonomy page. If left blank, the term name will be used.'), - '#weight' => 0, - ); - } +function taxonomy_title_form_taxonomy_form_term_alter(&$form, &$form_state) { + $title = _taxonomy_title_get_title($form['tid']['#value']); + $form['identification']['taxonomy_title'] = array( + '#type' => 'textfield', + '#title' => t('Taxonomy page title'), + '#default_value' => $title, + '#description' => t('This is the title you will see on your taxonomy page. If left blank, the term name will be used.'), + ); } /** - * Implementation of hook_taxonomy() + * Implementation of hook_taxonomy(). */ function taxonomy_title_taxonomy($op, $type, $array = NULL) { if ($type == 'term') { - switch($op){ + switch($op) { case 'delete': _taxonomy_title_delete_title($array['tid']); - break; + break; + case 'update': _taxonomy_title_delete_title($array['tid']); - _taxonomy_title_insert_title($array['tid'], $array['tax_title']); - break; + _taxonomy_title_insert_title($array['tid'], $array['taxonomy_title']); + break; + case 'insert': - _taxonomy_title_insert_title($array['tid'], $array['tax_title']); - break; + _taxonomy_title_insert_title($array['tid'], $array['taxonomy_title']); + break; } } } -function _taxonomy_title_delete_title($tid){ - db_query('DELETE FROM {taxonomy_title} WHERE tid = %d', $tid); +function _taxonomy_title_delete_title($tid) { + db_query("DELETE FROM {taxonomy_title} WHERE tid = %d", $tid); } -function _taxonomy_title_insert_title($tid, $title){ - if ($title != ''){ - db_query('INSERT INTO {taxonomy_title} VALUES (%d, "%s")', $tid, $title); +function _taxonomy_title_insert_title($tid, $title) { + if (!empty($title) { + db_query("INSERT INTO {taxonomy_title} (tid, title) VALUES (%d, '%s')", $tid, $title); } } -function _taxonomy_title_get_title($tid){ - $title = db_result(db_query('SELECT title FROM {taxonomy_title} WHERE tid = %d', $tid)); +function _taxonomy_title_get_title($tid) { + $title = db_result(db_query("SELECT title FROM {taxonomy_title} WHERE tid = %d", $tid)); return $title; } -/* - * Implementtion of hook_preprocess - * overrides variables sent to template_preprocess +/** + * Implementation of hook_preprocess_page(). + * + * Overrides variables sent to template_preprocess. */ -function taxonomy_title_preprocess(&$variables, $hook) { - if ($hook == 'page' && arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2)) && arg(2) > 0) { +function taxonomy_title_preprocess_page(&$variables) { + if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2)) && arg(2) > 0) { $title = _taxonomy_title_get_title(arg(2)); - if ($title){ + if (!empty($title)) { // Sets the meta title. drupal_set_title($title); + // Assures the page heading is set. $variables['title'] = drupal_get_title(); } } } - - - - Index: taxonomy_title.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_title/taxonomy_title.install,v retrieving revision 1.2 diff -u -r1.2 taxonomy_title.install --- taxonomy_title.install 3 Mar 2009 07:49:16 -0000 1.2 +++ taxonomy_title.install 18 Nov 2009 23:46:05 -0000 @@ -1,4 +1,5 @@ - 'Records separate titles/headings for taxonomy term pages', + 'description' => 'Records separate titles/headings for taxonomy term pages', 'fields' => array( - 'tid' => array( + 'tid' => array( 'type' => 'int', - 'length' => '11', - 'unsigned' => TRUE, - 'default' => 0, - 'not null' => TRUE), + 'length' => '11', + 'unsigned' => TRUE, + 'default' => 0, + 'not null' => TRUE, + ), 'title' => array( - 'type' => 'varchar', - 'length' => '255', - 'default' => '', - 'not null' => TRUE ), + 'type' => 'varchar', + 'length' => '255', + 'default' => '', + 'not null' => TRUE, + ), ), 'primary key' => array('tid'), ); + return $schema; } \ No newline at end of file Index: taxonomy_title.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_title/taxonomy_title.info,v retrieving revision 1.2 diff -u -r1.2 taxonomy_title.info --- taxonomy_title.info 3 Mar 2009 07:49:16 -0000 1.2 +++ taxonomy_title.info 18 Nov 2009 23:46:05 -0000 @@ -1,5 +1,5 @@ ; $Id: taxonomy_title.info,v 1.2 2009/03/03 07:49:16 jenlampton Exp $ name = Taxonomy Title -description = Enables control over the taxonomy page titles +description = Enables control over the taxonomy page titles. dependencies[] = taxonomy core = 6.x \ No newline at end of file