function widgets_nodeapi in Widgets 6
Implementation of hook_nodeapi().
File
- ./
widgets.module, line 133 - Implementaion of module hooks for Widgets module.
Code
function widgets_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
// Check if widgets are enabled for node type.
if (!variable_get("widgets_enabled_{$node->type}", 0)) {
return;
}
// Insert/update.
switch ($op) {
case 'insert':
case 'update':
module_load_include('inc', 'widgets');
widgets_write_record($node);
break;
case 'load':
$data = db_fetch_object(db_query('SELECT * FROM {widgets_status} WHERE nid = %d', $node->nid));
$node->disable_widgets = $data->disabled;
$node->default_widgets = $data->use_default;
break;
}
}