[development] Add node without node/add

Ezra B. Gildesgame ezra at pingv.com
Tue Apr 1 16:31:22 UTC 2008


Hi Sean,

You may be interested in the discussion that happened recently on  
this list: http://lists.drupal.org/archives/development/2008-03/ 
msg00063.html

Ezra Gildesgame

On Apr 1, 2008, at 12:05 PM, 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



More information about the development mailing list