When I attempting to set a context filter on a panels layout (apply the layout to a specific group), I get a set of error messages. These are repeated when I attempt to view the page (the filter does not work).
Notice: Trying to get property of non-object in og_context_create_og_group() (line 199 of [drupal home]/sites/all/modules/og/og_context/og_context.module).
Warning: array_flip(): Can only flip STRING and INTEGER values! in EntityAPIController->load() (line 184 of [drupal home]/sites/all/modules/entity/includes/entity.controller.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 354 of [drupal home]/includes/entity.inc).
Notice: Trying to get property of non-object in og_context_create_og_group() (line 199 of [drupal home]/sites/all/modules/og/og_context/og_context.module).
Warning: array_flip(): Can only flip STRING and INTEGER values! in EntityAPIController->load() (line 184 of [drupal home]/sites/all/modules/entity/includes/entity.controller.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 354 of [drupal home]/includes/entity.inc).
This is happenning reproducibly on a fresh D7 install, with or without the following entities patch:
http://drupal.org/node/1220212#comment-5181770
Comments
Comment #1
amitaibuDid you try with og -dev?
Comment #2
pav commentedJust tried it. Same result. I get to Selection rules >> Contexts, save my context (OG group, group ID = 1), click "Continue" and get
...which is exactly what happens with the released version. (The error on line 354 appears when I view the resulting page.)
Comment #3
amitaibuIt seems that you somehow selected the og-context with "select" option, but didn't add a group ID. Can you remove and re-add that option again.
Comment #4
pav commentedHere's what's happening (reproducibly on different installs):
Home >> Administration >> Structure >> Pages and Variants >>[X Page Layout] >> Contexts:
In the "Contexts" section of the page I select "OG Group".
In the Add context “OG Group” popup I have the following:
Identifier: OG Group
Keyword: group
Enter the context type: Select an OG group
Enter a group ID: 1
(I've checked the "og" table in the database; I do have a group with gid = 1, etid = 1.)
When I click "Finish", the popup closes and everything looks great. Then, when I click "Update and Save" I get the above error message. The problem disappears when I delete the context and reappears when I re-enter it.
Comment #5
pav commentedAn identical error surfaces when I try to set a context in Mini-panels.
Comment #6
amitaibuAre you trying this on a clean installation?
Comment #7
pav commentedYep. Just tried it on a completely fresh install with only the following enabled:
Same result.
Comment #8
pav commentedI'm sorry, this is probably a daft question, but I can't find the answer in the documentation. What does hook_create_og_group actually do?
Comment #9
pav commentedI think, there might be a wider issue with contexts in page manager.
http://drupal.org/node/1330096
Comment #10
pav commentedI'm sorry, to be a pain, but I don't suppose you've had a chance to have a look at this? I've just updated to the latest version of the core, and I've got the latest dev versions of OG, panels and ctools, but no joy - still the same error message. This is a massive pain in the neck. I'm more or less clueless on the coding side, but I'd be happy to help with the testing.
Comment #11
VanD commentedI am having the same issue with 7.x-1.3
I get the error (warning) about 8 times per page load.
Comment #12
veades commentedI found the same problem with 7.x-2.0.
I noticed in og_context 7.x-1.3 that og_context() returns an array with group_type and gid. And I was running into problems, because some og modules I was trying to use (og_theme and context_og) were trying to use the returned values from og_context() as an entity (or at least an object).
This might be the case with the modules you are using as well.
I am guessing some point in the past og_context() returned an entity object? And the external modules haven't adapted to the change.
Just a thought.
I got around the problem by writing my own version of og_theme module. I would be curious to know whether og_context will stick to returning array or if it will go (back?) to returning an entity? I see that og_context version 7.x-2.0-alpha2+59-dev is still using the array.
Comment #13
joelpittetDrupal 7 reached end-of-life and the D7 version of Organic Groups is no longer being developed. To keep the issue queue focused on supported versions, we’re closing older D7 issues. If you still have questions about using Organic Groups on Drupal 7, feel free to ask. While we won’t fix D7 bugs anymore, we’re happy to offer guidance to help you move forward. You can do so by opening (or reopening) a D7 issue, or by reaching out in the #og channel on Drupal Slack.
If this issue is still relevant for Drupal 10+, please open a follow-up issue or merge request with proposed changes. Contributions are always welcome! 💙