warning: Illegal offset type in isset or empty in /var/www/modules/taxonomy/taxonomy.module on line 1090, 1091 and 1094.
The taxonomy_get_term() function takes an ID for the first parameter ($tid). Currently we are getting an object passed back to it. It is a ctools_context object. I talked with merlinofchaos in #1810440: Incorrect data sent to taxonomy_get_term() and it turns out that page_manager does some things that end up making the $menu_item['map'][2] value equal the object instead of the expected id.
Although, this error is not because of page_title or page_manager but yet the combination of having them both installed. I would like to suggest a patch to the page_title module.
The patch would be very simple. If we take the following two functions 'taxonomy_page_title_alter' and 'taxonomy_page_title_pattern_alter' from the taxonomy.page_title.inc file and wrap an if statement around the current if statement in each function we could support people who use these modules in conjunction with each other.
Current Functions
<?php
/**
* Implementation of hook_page_title_alter().
*/
function taxonomy_page_title_alter(&$title) {
$menu_item = menu_get_item();
// NOTE: We user $menu_item['map'] here instead of $menu_item['page_arguments']
// as Views can interrupt the path ad moves the argument value from 0 to 2.
// See issue: /node/1203768
// If we're looking at a taxonomy term page, get the term title
if ( !strncmp($menu_item['path'], 'taxonomy/term/%', 15) &&
($term = taxonomy_get_term($menu_item['map'][2])) &&
variable_get('page_title_vocab_'. $term->vid .'_showfield', 0) &&
($term_title = page_title_load_title($term->tid, 'term')) ) {
$title = $term_title;
}
}
/**
* Implementation of hook_page_title_pattern_alter().
*/
function taxonomy_page_title_pattern_alter(&$pattern, &$types) {
$menu_item = menu_get_item();
// NOTE: We user $menu_item['map'] here instead of $menu_item['page_arguments']
// as Views can interrupt the path ad moves the argument value from 0 to 2.
// See issue: /node/1203768
// Taxonomy Term Page
if ( !strncmp($menu_item['path'], 'taxonomy/term/%', 15) &&
($term = taxonomy_get_term($menu_item['map'][2])) ) {
$types['taxonomy'] = $term;
$pattern = variable_get('page_title_vocab_'. $types['taxonomy']->vid, '');
}
}
?>
Modified Functions (with proposed solution from above)
<?php
/**
* Implementation of hook_page_title_alter().
*/
function taxonomy_page_title_alter(&$title) {
$menu_item = menu_get_item();
// NOTE: We user $menu_item['map'] here instead of $menu_item['page_arguments']
// as Views can interrupt the path ad moves the argument value from 0 to 2.
// See issue: /node/1203768
if (is_numeric($menu_item['map'][2])) {
// If we're looking at a taxonomy term page, get the term title
if ( !strncmp($menu_item['path'], 'taxonomy/term/%', 15) &&
($term = taxonomy_get_term($menu_item['map'][2])) &&
variable_get('page_title_vocab_'. $term->vid .'_showfield', 0) &&
($term_title = page_title_load_title($term->tid, 'term')) ) {
$title = $term_title;
}
}
}
/**
* Implementation of hook_page_title_pattern_alter().
*/
function taxonomy_page_title_pattern_alter(&$pattern, &$types) {
$menu_item = menu_get_item();
// NOTE: We user $menu_item['map'] here instead of $menu_item['page_arguments']
// as Views can interrupt the path ad moves the argument value from 0 to 2.
// See issue: /node/1203768
if (is_numeric($menu_item['map'][2])) {
// Taxonomy Term Page
if ( !strncmp($menu_item['path'], 'taxonomy/term/%', 15) &&
($term = taxonomy_get_term($menu_item['map'][2])) ) {
$types['taxonomy'] = $term;
$pattern = variable_get('page_title_vocab_'. $types['taxonomy']->vid, '');
}
}
}
?>
Comment | File | Size | Author |
---|---|---|---|
#1 | illegal_offset_fix-1811526-1.patch | 2.07 KB | Steven Brown |
Comments
Comment #1
Steven Brown CreditAttribution: Steven Brown commentedComment #2
DamienMcKennaThe D6 branch is no longer supported.