Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
When attempting to view a previous revision of a translated page using zurb_foundation 8.x-6.x-dev on Drupal 8.1.1 the following error is appearing:
Fatal error: Call to a member function bundle() on string in /var/www/drupalvm/docroot/themes/zurb_foundation/zurb_foundation.theme on line 259
Error is present when using sub-theme built from starterkit and using zurb_foundation as theme.
No error present when using "Bartik 8.1.1" or "Seven 8.1.1" theme.
Comment | File | Size | Author |
---|---|---|---|
#3 | zurb_foundation-fatal_error_call_to_a_member_function_bundle_on_string-2721981-3.patch | 1.36 KB | tim_dj |
Comments
Comment #2
bkhandruk CreditAttribution: bkhandruk commentedThis error occurs because when you're trying to view node revision, variable
$variables['node']
, passed into template_preprocess_page, is not an object. It's a string within current node ID. So, to fix this error I've added a check whether the variable$variables['node']
is an object. And if it's not, then this object is loaded by ID.Comment #3
tim_djAbove patch will still fail if you try to view a revision of a non-existing node id.
Also I think the correct function to add this suggestion would be "zurb_foundation_theme_suggestions_page_alter"
Comment #4
samuel.mortensonThis seems like an important bug to fix, I'm bumping the priority.
@tim_dj Can you explain why array_splice is being used here instead of the previous operation ($suggestions[] = ...)?
Comment #5
tim_djOtherwise the sequence of suggestions would be out of order:
array_splice
$suggestions[]
Comment #8
samuel.mortensonThank you @tim_dj! Committed to the 6 and 5 branches.
Comment #10
ressa CreditAttribution: ressa as a volunteer commentedThis is not related to the ZURB foundation theme, but I am posting this for others who find this issue, looking for help with
PHP Fatal error: Call to a member function bundle() on string
:From: http://drupal.stackexchange.com/questions/145823/how-do-i-get-the-curren...
Comment #11
ressa CreditAttribution: ressa at Ardea commentedI couldn't get the suggestions on the "Working with the Entity API" page to work, but making sure that
revisions
wasn't present in the URL seemed to do the trick:Comment #12
Guybrush Threepwood CreditAttribution: Guybrush Threepwood commented@ressa, Thank you so much! This saved me.