Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: [] operator not supported for strings #32

Open
tonystar opened this issue Jul 26, 2015 · 2 comments
Open

Fatal error: [] operator not supported for strings #32

tonystar opened this issue Jul 26, 2015 · 2 comments

Comments

@tonystar
Copy link
Collaborator

Fatal error: [] operator not supported for strings in /tweme/template.php on line 111

@tonystar tonystar added the Bug label Jul 26, 2015
@tonystar tonystar added this to the 7.x-3.0 milestone Jul 26, 2015
@acondura
Copy link

Hi Tony,

I left a comment in the commit too and I believe I've just fixed this issue.

The problem happens when using Panels IPE. If you look into file panels/panels_ipe/panels_ipe.module at lines 139 and 204, you’ll see that only line 139 adds a class as a string instead of an array.

So, I changed the code so that it first checks whether $vars[‘attributes’][‘class’] is an array. If it holds a string, then turn it into an array, add the existing class and then continue with adding the ‘list-unstyled’ class.

I ran into this issue on my own website (condurachi.ro) and I thought I’d give a helping hand. I really like your theme.

Regards,
Andrei

@acondura
Copy link

I tried syncing my commit to your repo but it looks like I don't have the right permissions. Here's the code change that I did to solve the issue:

function tweme_preprocess_links(&$vars) {

Check if the class value is not an array

if(!is_array($vars['attributes']['class'])) {
# Hold the existing value in variable
$temp_value = $vars['attributes']['class'];
# Transform the class to an array
$vars['attributes']['class'] = array();
# Add the existing value to the class array
$vars['attributes']['class'][] = $temp_value;
}
$vars['attributes']['class'][] = 'list-unstyled';
}

@tonystar tonystar removed the bug label Mar 14, 2017
@tonystar tonystar removed this from the 7.x-3.0 milestone Mar 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants