1. Install core
2. Go to node/add/article
3. Go to admin/reports/dblog and see that there is a watchdog error message "Theme key "node_form" not found."

This should not be happening on a fresh install, or we need to downgrade this error message. This is absolutely messing on tests in XML sitemap that checks if the watchdog table doesn't have any errors or warnings during its tearDown() function.

Comments

boombatower’s picture

subscribe

qasimzee’s picture

subscribe

bshort’s picture

Subscribe

dmitrig01’s picture

Bonus points (but a separate bug): click the link (assuming the overlay is installed) to node/add/article?render=overlay

douggreen’s picture

The problem is coming from node.pages.inc+278, what is this supposed to be:

  $form['#theme'] = array($node->type . '_node_form', 'node_form');
dmitrig01’s picture

Assigned: Unassigned » dmitrig01

I've got this one. The problem is much deeper.

iLLin’s picture

I have tracked this issue to theme.inc

  // If an array of hook candidates were passed, use the first one that has an
  // implementation.
  if (is_array($hook)) {
    foreach ($hook as $candidate) {
      if (isset($hooks[$candidate])) {
        break;
      }
    }
    $hook = $candidate;
  }

If no $hook was found in the $hooks array then the last hook iterated through the foreach loop is put as the value of $hook. $hook = $candidate. The array passed as $hook contains two values: $node_type_node_form and node_form. There is no theme hook defined as either of these. So one of two things needs to happen (I think). There needs to be a theme implementation of node_form (Is this missing on purpose? It was available in 6.). Or there needs to be a graceful failout instead of logging a watchdog.

Thoughts?

mgriego’s picture

This is related to #596582: Remove remnants of theme_node_form(). It looks like theme_node_form was removed on purpose. Actually, looking further, the node_form looks like it's being replaced with node_edit_form. And, in fact, it looks like the whole $node-type.'_node_form' system no longer works like it was before. Maybe in the middle of a switch to using a single node_edit_form instead of distinct node type _node_form forms?

EvanDonovan’s picture

I have noticed this at least for the last month (since alpha3), but didn't report it, since I thought someone else had. Sorry, I should've checked.

yoroy’s picture

dmitrig01: any chance on an update? Let us know what's up.

nancydru’s picture

subscribe

pwolanin’s picture

seeing this also.

dave reid’s picture

Status: Active » Needs review
StatusFileSize
new675 bytes

I think this is the only solution then.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

fine with me. its easy enough to form alter and add a #theme

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

nancydru’s picture

Indeed, the errors are gone. Thanks.

sun’s picture

Status: Fixed » Needs work

Not sure whether this was the right fix.

Effectively, this means that the behavior for a single theme hook (string) is different to the behavior for theme hook suggestions (array).

That is, because http://api.drupal.org/api/function/drupal_build_form/7 automatically assigns $form_id as #theme hook, if #theme is not defined (which no longer is). In turn, this means that the node_form still has a #theme defined, and still points to a non-existing theme hook, but just because it's a single hook suggestion, instead of an array of suggestions, it "suddenly" doesn't throw a watchdog warning.

Now, after writing this down, I am sure this was the wrong fix.

effulgentsia’s picture

Status: Needs work » Fixed

I believe this fix was okay. theme() is consistent in throwing a watchdog when a single passed $hook isn't implemented, or if none of the items in the array are implemented. drupal_build_form() only sets #theme if the $form_id exists as a hook in the registry. Perhaps restoring the functionality lost by #13 can be rolled into #757154: Base form_id via hook_forms() not taken into account for #validate, #submit, hook_form_FORMID_alter(), but with the registry checks that drupal_build_form() does?

Status: Fixed » Closed (fixed)

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