Posted by Alan D. on September 21, 2010 at 12:08am
5 followers
| Project: | Fusion |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | needs work |
Issue Summary
I created a grid with over 100 columns and things broke. Looking at the code, I realized that it would only work when there are 10 to 99 columns / grids defined, as there was a few calls to substr($name, 4, 2) to pull out this.
The following code uses explode('-', $name) to bypass this issue.
Sorry, the CVS server is not creating a valid patch, so I'm just pasting the code in.
fusion/fusion_core/template.php
<?php
// $Id: template.php,v 1.1.2.9 2010/07/04 22:34:29 sociotech Exp $
### line 37
// Set grid info & row widths
- $grid_name = substr(theme_get_setting('theme_grid'), 0, 7);
- $grid_type = substr(theme_get_setting('theme_grid'), 7);
- $grid_width = (int)substr($grid_name, 4, 2);
+ list($grid_name, $grid_type) = explode('-', theme_get_setting('theme_grid'));
+ $grid_width = (int)substr($grid_name, 4);
+ $grid_name .= '-';
### line 243
// Initialize block region grid info once per page
if (!isset($regions)) {
- $grid_name = substr(theme_get_setting('theme_grid'), 0, 7);
- $grid_width = (int)substr($grid_name, 4, 2);
- $grid_fixed = (substr(theme_get_setting('theme_grid'), 7) != 'fluid') ? 1 : 0;
+ list($grid_name, $grid_type) = explode('-', theme_get_setting('theme_grid'));
+ $grid_width = (int)substr($grid_name, 4);
+ $grid_name .= '-';
+ $grid_fixed = ($grid_type != 'fluid') ? 1 : 0;
?>fusion/fusion_core/theme-settings.php
<?php
// $Id: theme-settings.php,v 1.1.2.6 2010/04/08 07:02:59 sociotech Exp $
## line 127
// Generate grid type options
$grid_options = array();
if (isset($info_theme_settings['theme_grid_options'])) {
foreach ($info_theme_settings['theme_grid_options'] as $grid_option) {
$grid_type = (substr($grid_option, 7) == 'fluid') ? t('fluid grid') : t('fixed grid') . ' [' . substr($grid_option, 7) . 'px]';
$grid_options[$grid_option] = (int)substr($grid_option, 4, 2) . t(' column ') . $grid_type;
}
}
// ---- changes to
// Generate grid type options
$grid_options = array();
if (isset($info_theme_settings['theme_grid_options'])) {
foreach ($info_theme_settings['theme_grid_options'] as $grid_option) {
list($grid_name, $grid_type) = explode('-', $grid_option);
$grid_width = (int) substr($grid_name, 4);
$grid_type = ($grid_type == 'fluid') ? t('fluid grid') : t('fixed grid') . ' [' . $grid_type . 'px]';
$grid_options[$grid_option] = $grid_width . t(' column ') . $grid_type;
}
}
## line 167
// Calculate sidebar width options
- $grid_width = (int)substr($settings['theme_grid'], 4, 2);
- $grid_type = substr($settings['theme_grid'], 7);
+ list($grid_name, $grid_type) = explode('-', $settings['theme_grid']);
+ $grid_width = (int) substr($grid_name, 4);
?>The rather large style sheet & ini file segment area attached for testing, but creating a 2 or 3 grid array will also break the logic in the code.
Cheers
Alan
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| tmp.ini_.txt | 25.39 KB | Ignored: Check issue status. | None | None |
| grid192-960.css_.txt | 13.62 KB | Ignored: Check issue status. | None | None |
Comments
#1
PS: I'm totally new to the project, so this needs so experienced eyes on it.
I've created a patch against the themes folder in the project using SVN to show the above modifications better, but this can not be applied to the checked out theme from Drupal CVS.
#2
Bumping to critical as this seems to have been ignored and with grids <10 & >99, the entire theme is unusable.
#3
#4
#5
#6
The last submitted patch, unlimited-columns.patch, failed testing.