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.
When the node add form is being loaded, the contentanalysis module will init a node object on node/add.
Here's the code in question:
From line 246 onwards in contentanalysis.module:
// init node value if node/add
if(!isset($node->nid) || !$node || !$node->nid) {
// Load the next nid from the table
if (!$node->nid = (int)db_next_id(db_query('SELECT MAX(nid) FROM {node}')->fetchField())) {
$node->nid = -1;
}
}
This conflicts with pathauto that expects the id to be missing for new nodes,
in order to properly tick the checkbox for the "generate url alias" checkbox.
From line 294 in pathauto.module
if (!isset($entity->path['pathauto'])) {
if (!empty($id)) {
Can something be done about this?
There might also be other modules that initialize the node id before the vertical tabs in the form are loaded.
Comments
Comment #1
svenryen CreditAttribution: svenryen commentedHere's a quick fix...
Replace the two lines in the issue summary with this code
Comment #2
Dave ReidThat is *SO* a bug in contentanalysis. It should and cannot modify $node->nid in the form for new nodes. That's going to cause multiple failures with other modules.
Comment #3
TomDude48 CreditAttribution: TomDude48 commentedI have changed the way this is handled in the alpha5 release.
Please update and test.
Comment #4
Dave ReidDoesn't look like this was actually addressed. contentanalysis_analysis_form() is still altering $node->nid to equal -1 for new nodes and this affects other modules (since $node is $form['#node']) since objects are passed by reference by default in PHP 5.
Comment #5
TomDude48 CreditAttribution: TomDude48 commentedMissed that one. There are two forms and only fixed one of them.
They both should work now in the beta release