Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.
I have been working a lot with the new forms API and it is great. I am having one problem though that is becoming very frustrating and I cannot for the life of me figure out the solution.
I'm currently developing a dynamic javascript menu (module). Since it's a javascript menu I need some kind of way to tell drupal the position where the user is currently navigating in the menu. (Tree-menu). So when the user expands 3 levels of menus and then click on the "Home"-link, the menu should not collapse, but remember where the user is currently navigating.
I was wondering what would be the best way to go about creating a node from within the cron hook of the same module.
Say you wrote a node that stores RSS from different feeds. In a cron job, I would like that RSS stuff to be inserted in the node.
The first thing that came to my mind was just to use plain "INSERT INTO ..." sql, but then I am lost as to how to get the "next" node id value. After that I thought about using the implemented hook: _insert() but then I was lost as to what kind of parameter does it except and how to go about building a $node object.