+1 to this. maybe slightly more complex to set up, but declaring variables forces some thought into structure, helps keep them centralized in code, easily extensible. of course, this opens up the can-of-worms possibility of hook_variables_alter... :P Larry Garfield wrote:
hook_variables() { $items = array(); $items['mymod_num_things'] = array( '#default_value' => 2, // Same syntax as FAPI uses '#realm' => 'mymod', // optional '#translatable' => FALSE, // probably default false '#cacheable' => TRUE, // default to TRUE if under X chars when serialized '#serialize' => FALSE, // default to true for object/array, else false ); foreach (node_get_types('name') as $type) { $items['mymod_things_for_' . $type] = array( '#default_value' => array(), ); }
return $items; }