Hi,
I'm new to drupal and startet writing my own modules. Now that I have tried the upcoming 5.0 version of drupal I want to continue developing my modules for the new version.

I created a new node type and extended the node form by using the hook_form(). According to http://drupal.org/node/64279 (Converting 4.7.x modules to 5.x) this hook does not seem to have been changed or removed so I thought at least displaying the nodes form should work. But it seems I'm wrong.

I get following error message:
warning: array_merge_recursive() [function.array-merge-recursive]: Argument #2 is not an array in C:\xampplite\htdocs\drupal\modules\node\node.module on line 1916.

The mentioned line is as follows:

...
// Get the node-specific bits.
$form = array_merge_recursive($form, node_invoke($node, 'form', $form_values));
...

As far as I understand it the node_invoke(...) part should return my array I built in my hook_form() which doesn't seem to be the case.
But it had to be an array in the 4.7.x version anyway. There it works.

Anyone has an idea? If its a known bug I'm sorry to have asked but I Don't know where to view the current bugs etc.

Comments

Dave Cohen’s picture

I don't see the warning you mention, but my hook_form was not being called. Eventually, I figured out it's because hook_node_info changed. In hook_node_info, you have to change the array index formerly called 'base' to 'module'.

It frustrates me how much work is involved in porting a module from one version of drupal to the next. Drupal treats backward compatability like a disease to be avoided, and this sort of pointless API change infuriates me. What a waste of time as developer after developer has to discover this!

zerok’s picture

Thank you very much :-) I guess you just saved me from hours of debugging.

lordslumber’s picture

I ran into the same problem. Switching from "base" to "module" worked. Googled for help and found it via your website, zeroK, thanks.

trevelyan’s picture

I am running into the same bug. God knows what the solution is, since I don't see mention of this change on the list of "how to update modules" pages.

Does anyone know of a good template module? Since I only need to make minor changes I would normally update my module by simply editing the "page" or "story" modules, but these seem to have disappeared. Where do we go to find a working template for reference?

syndrome’s picture

At first I thought the changed "hook_node_info" was not the problem I am facing. But eventually I found out that my node hook wasn't called either. So I gave it another detailed look and updated my hook_node_info. Now it works. Don't forget to unload the module in the "Module" settings and enable it again.

Thanks yogadex, should have had a closer look on "hook_node_info" earlier.