By drakeguan on
Hi All,
I wrote up a CCK field module which is something like 'Computed field' with specific function and I would like to give it a test on my existing web site. For that, I need to update all related nodes to see if that module works correctly. I do this by the following hook:
Let's say the module name is 'ooxx'.
<?php
function _ooxx_update_nodes($nodes) {
foreach ($nodes as $key => $nid) {
$node = node_load($nid);
node_invoke($node, 'update');
node_invoke_nodeapi($node, 'update');
}
}
function ooxx_node_operations() {
$operations = array(
'update' => array(
'lable' => t('Update the selected nodes'),
'callback' => _ooxx_update_nodes,
),
);
return $operations;
}
?>Is it a good way to do that? Or are there already some functions in Drupal core with the same functionnality?
Drake
Comments
lable?
lable?