Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
While editing a node I get this error:
Notice : Undefined property: stdClass::$menu in menu_views_node_prepare() (line 396 in ...sites/all/modules/menu_views/menu_views.module)
I looked into the code and I think that the test on that line is not good :
if (isset($node->nid) && !$node->menu['mlid']) {
should be replaced by :
if (isset($node->nid) && !isset($node->menu['mlid'])) {
Am I right ?
Comments
Comment #1
markhalliwellNot entirely, no. This is somewhat of a complex area to begin with. The menu module should construct the default menu options in menu_node_prepare(). This hook should be called before Menu Views gets a chance to implement it's own hook_node_prepare(). So I don't see how this is really possible, at all. It just doesn't make sense as Menu Views is dependent on the menu module and it should load and get called before Menu Views. So the
$node->menu['mlid']
should exist and at least have a value of at least the default 0 (which means no menu item exists).If anything, I guess a short term solution (if it's really bothering you and before I can take some real time to look at why this might be happening), would be to implement something like the following above that if statement:
Comment #2
markhalliwellDid this fix your problem or was it some configuration on your site?
Comment #3
markhalliwellFixed with release of 7.x-2.1 (http://drupal.org/node/1909888)