backdrop-contrib / d7compatible

A base theme that restores some markup to the way it was output from Drupal 7.
GNU General Public License v2.0
3 stars 2 forks source link

Error: [] operator not supported for strings in d7compatible_preprocess_node() #1

Closed StijnHaulotte closed 1 year ago

StijnHaulotte commented 1 year ago

Error: [] operator not supported for strings in d7compatible_preprocess_node() (line 55 of /app/www/themes/contrib/d7compatible/d7compatible/template.php).

klonos commented 1 year ago

Hey @StijnHaulotte 👋🏼 ...welcome to the Backdrop contributed project issue queue. Thanks for taking the time to report this issue.

Can you please provide some further information about this error you are receiving? For example, have you created a subtheme based off of d7compatible, and if so, is this a custom theme or one that os available in contrib? In general, in order to be able to fix a problem, we first need to be able to reproduce it. So if you could provide step-by-step instructions on how to do that, it would help us a lot.

StijnHaulotte commented 1 year ago

It is the theme that was used for Drupal7 Also phpsttorm gives this warning image i got rid of it by making sure $variables['classes'] is an array wit $variables['classes']= array befor the [] is used on it.

klonos commented 1 year ago

i got rid of it by making sure $variables['classes'] is an array wit $variables['classes']= array befor the [] is used on it.

Hmm 🤔 ...I can see that earlier in the code, in line 45, the $variables['classes'] array is implode()ed into a string. So while you are right, it would be preferable if we instead moved the entire if ($variables['view_mode'] == 'teaser') { section before that implode().

Here's a PR that does that: https://github.com/backdrop-contrib/d7compatible/pull/2

Pinging @jenlampton since she is the maintainer of this project.