[development] Add node without node/add

Ken Rickard agentrickard at gmail.com
Wed Apr 2 00:31:06 UTC 2008


Did you try drupal_execute()?

http://api.drupal.org/api/function/drupal_execute/6

As Ezra said, see the previous discussion thread for the pros and cons to
this approach.

- Ken Rickard
agentrickard

On Tue, Apr 1, 2008 at 2:45 PM, Kyle Mathews <mathews.kyle at gmail.com> wrote:

> Node_factory is a great idea for a module as this problem, creating
> nodes programatically, seems to come up all the time. It'd be great if
> best practices  could be put into node_factory. I used it recently to
> create a custom module using workflow_ng and node_factory to auto
> create nodes and it worked great.
>
> Kyle
>
> On Tue, Apr 1, 2008 at 11:45 AM, Clemens Tolboom <clemens at build2be.nl>
> wrote:
> > I'm trying to build this module http://drupal.org/project/node_factory
> >  which seems to be not trivial.
> >
> >  It work fine with simple node types without cck or Access Control
> >  modules like og.
> >
> >  With the discussion mentioned by Ezra B. Gildesgame and some love from
> >  some developers I hope to make the module better.
> >
> >
> >
> >  On Tue, 2008-04-01 at 09:05 -0700, Sean Wingert wrote:
> >  > Is there a (programmatic?) way to add a node *without* using
> node/add/something and still gain access to hook_validate(), hook_insert(),
> hook_update(), and hook_delete()? I'm trying something like this but
> hook_validate does not seem to fire...
> >  >
> >  > function property_menu($may_cache) {
> >  >   $items=array();
> >  >   // Do not cache this menu item during the development of this
> module.
> >  >   if (!$may_cache) {
> >  >     $items[] = array(
> >  >       'title' => t('Review'),
> >  >       'path' => 'property/create',
> >  >       'access' => user_access('create property'),
> >  >       'type' => MENU_LOCAL_TASK,
> >  >       'weight' => 1,
> >  >     );
> >  >   }
> >  >   return ($items)
> >  > }
> >  >
> >  > function property_validate($form_id, $form_values) {
> >  >         //validate property number
> >  >         if (!preg_match('/^\d{1,4}$/',$form_values['pnum'])) {
> >  >       //watchdog('security',t('Bad property number entered'),
> WATCHDOG_WARNING);
> >  >       form_set_error('pnum',t('The property number does not appear to
> be valid. It should be 3 numbers long.'));
> >  >     }
> >  > }
> >  >
> >  > Thanks!
> >  >
> >  > Sean
> >  --
> >  Clemens Tolboom
> >  build2be
> >  KvK NL020994130000
> >
> >  info at build2be.nl
> >  http://build2be.nl
> >  +31(0)6 10 27 96 95
> >
> >
>
>
>
> --
> Research Assistant
> eBusiness Center @ BYU
> kyle.mathews2000.com/blog
>



-- 
Ken Rickard
agentrickard at gmail.com
http://ken.therickards.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20080401/b271f0f2/attachment.htm 


More information about the development mailing list