Closed (fixed)
Project:
Collapse Text
Version:
7.x-2.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Sep 2011 at 09:03 UTC
Updated:
10 Aug 2012 at 18:41 UTC
Hi,
I was able to get this module to work fine in an old test site which was using Drupal 7.4. However it is causing problems now I have updated to Drupal 7.8. When I enable this module I get a blank screen when I try to access;
- /admin/config/content/formats/full_html (Full HTML text format page, so I can't set up the site to use this module).
- The pages where you edit content of a block.
- The views editing pages.
I don't know if it is just me that is getting this, or it is a known issue. But this is a good module and I would like help with with this issue.
Cheers,
Comments
Comment #1
scottyboyearl commentedI managed to get it to work. I switched to the 7.x-2.3 version and in the .MODULE file I removed the section of code between lines 586 and 612. These lines contained the code shown below.
/**
* add the collapse.js file if needed.
*
* This is probably the wrong method to take. This may be more intensive than just
* adding the library to everything, and may mess with aggregated files (?).
*
* I have no idea what the right thing to do here is.
*
* based on #947710, jrockowitz
*/
function collapse_text_preprocess_page (&$variables) {
// if collapse.js is not already included
if ( strpos(drupal_get_js(), 'misc/collapse.js') == FALSE ) {
// see if we need to add it
$found = FALSE;
// ** there is some kind of recursion issue; the mucking with warnings is to
// ** suppress a whole lot of notifications...
$error_level = error_reporting();
error_reporting($error_level ^ E_WARNING);
array_walk_recursive($variables['page'], '_collapse_text_preprocess_page_walk_callback', &$found);
error_reporting($error_level);
if ($found) {
// and if we do, then do so...
drupal_add_library('system', 'drupal.collapse');
}
}
}
I hope this helps others.
Cheers.
Comment #2
Kman2123 commentedsame issue. I had to disable to get to some admin pages :(
Comment #3
joel_osc commentedFor others that may be seeing this issue that part of the code will generate the following error message:
Warning: array_walk_recursive(): recursion detected in collapse_text_preprocess_page() (line 605 of /var/www/ctai/sites/all/modules/collapse_text/collapse_text.module).
Comment #4
refman1073 commentedAs the code comments in that section indicate the array walk of the page structure is not the best way to solve the javascript problem. I think I have a better approach. I believe that filter functions are only used on text fields, so scan the text field values when the field is attached for viewing using hook_field_attach_view_alter(). This solves the problem for me.
1. Delete the collapse_text_preprocess_page and _collapse_text_preprocess_page_walk_callback functions.
2. Add the following code as a replacement:
Comment #5
joel_osc commentedTested above code...seems to work well.
Comment #6
mstrelan commentedSee also #1664952: Current method of including library only when needed is awful and #1522346: array_walk_recursive error when editing content type
Comment #7
pukku commentedClosing because it will be fixed with the release which fixes the others...