I have a situation where ctools_page_token_processing() is processing a 'callback' type token where the callback function is 'ctools_page_title_content_type_token'.

That function lives in ctools/plugins/content_types/page/page_title.inc, and when the function_exists() check is made, it fails, indicating that the include file has not been loaded.

The only other instance of the string 'ctools_page_title_content_type_token' in my code base is also in page_title.inc where this token is set by ctools_page_title_content_type_render(), so I figured it must be related to caching. Sure enough, if I clear the caches this problem disappears for the first page view, and returns for the subsequent views.

The visible symptom of this bug is the error: "Notice: Array to string conversion in strtr()", because the 'callback' case of that switch statement had no effect, and consequently the array value for that particular $tokens[$token] was retained when strtr($children, $tokens); was called.

CommentFileSizeAuthor
#4 1365522-4-page_title-cache.patch524 bytesjoelpittet

Comments

jweowu’s picture

jweowu’s picture

Issue summary: View changes

added error message for searchability

Exploratus’s picture

Subscribe!

robinmofo’s picture

Issue summary: View changes

If for some reason you're getting this issue, you can easily include the file in hook_panels_pre_render() in order to fix the include issue.

/**
 * Implements hook_panels_pre_render().
 */
function HOOK_panels_pre_render($panels_display, $renderer) {
  module_load_include('inc', 'ctools', 'plugins/content_types/page/page_title');
}

It might save someone some time, my page titles were printing 'Array'.

joelpittet’s picture

Status: Active » Needs review
StatusFileSize
new524 bytes

This is a long standing bug apparently, I worked with @brunodbo today to get to the bottom of this. Here's a solution to get the includes working for the content_types plugin. It only works for ctools content plugins, not custom ones, but page_title is the only one that implements this token replacement hook ctools.

Thanks also for the workaround @frobinrobin, that can work as a workaround for any custom implementations still.

Thoughts on this approach?