On creating new content based on closed question, an error occures:

Notice: Undefined property: stdClass::$nid in custom_breadcrumbs_paths_cb_node_form_table() (Line 246 of /......./sites/all/modules/custom_breadcrumbs/custom_breadcrumbs_paths/custom_breadcrumbs_paths.module).

Comments

Cebra’s picture

Status: Active » Closed (won't fix)
Anonymous’s picture

Title: Undefined property » Undefined property: stdClass::$nid in custom_breadcrumbs_paths_cb_node_form_table()
Project: Closed Question » Custom Breadcrumbs
Status: Closed (won't fix) » Active

Re-opening this under the correct project.
When adding any new content, I get this bug too.

Possible solution looks like this:

function custom_breadcrumbs_paths_cb_node_form_table($node) {
  if (!isset($node->nid)) {
    return;
  }

I added a check for $node->nid

klonos’s picture

Getting this one too when trying to create any kind of node. I was not sure if the code in #2 is supposed to replace the if (!isset($node->path)) condition or to go before it. I went the second way, from:

function custom_breadcrumbs_paths_cb_node_form_table($node) {
  if (!isset($node->path)) {
    $node->path = drupal_lookup_path('alias', "node/" . $node->nid);
  }
  $matchpath = variable_get('custom_breadcrumbs_paths_allow_wildcards', FALSE);
...

...to:

function custom_breadcrumbs_paths_cb_node_form_table($node) {
  if (!isset($node->nid)) {
    return;
  }
  if (!isset($node->path)) {
    $node->path = drupal_lookup_path('alias', "node/" . $node->nid);
  }
  $matchpath = variable_get('custom_breadcrumbs_paths_allow_wildcards', FALSE);
...

...and now the error message seems to have gone away.

Anonymous’s picture

Yeah exactly, that's how I did it, just add in the extra check.

klonos’s picture

...thought so. It's just that in your code block in #2 you enclosed all of it in php open/close tags and I didn't know what. Thanx!

MGN’s picture

Status: Active » Fixed

Confirmed. thanks for testing. This has now been fixed in the latest commit for 7.x-2.x-dev.

straszko’s picture

thanks for the solution!

klonos’s picture

Thanx for the prompt actions Michael and you Mathijs for the good catch and providing a quick fix.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.