function coder_upgrade_callback_comment in Coder 7
Same name in this branch
- 7 coder_upgrade/conversions/other.inc \coder_upgrade_callback_comment()
- 7 coder_upgrade/conversions/function.inc \coder_upgrade_callback_comment()
Same name and namespace in other branches
- 7.2 coder_upgrade/conversions/other.inc \coder_upgrade_callback_comment()
- 7.2 coder_upgrade/conversions/function.inc \coder_upgrade_callback_comment()
Updates hook_comment().
ADD THIS TO: hook_nodeapi, hook_node_type, hook_user, and hook_block removed and replaced with families of related functions
2 string references to 'coder_upgrade_callback_comment'
- coder_upgrade_callback_functions in coder_upgrade/
conversions/ other.inc - Callback routine for function changes using grammar parser.
- coder_upgrade_upgrade_hook_comment_alter in coder_upgrade/
conversions/ function.inc - Implements hook_upgrade_hook_comment_alter().
File
- coder_upgrade/
conversions/ other.inc, line 1579 - Other conversion routine file for the coder_upgrade module.
Code
function coder_upgrade_callback_comment($node, $case_node, $operation = '') {
cdp("inside " . __FUNCTION__);
if (!$operation) {
$case =& $case_node->data;
if (!is_a($case, 'PGPCase')) {
cdp("Houston, we've got an unexpected statement");
return;
}
$operation = $case->case
->toString();
$operation = trim($operation, "'\"");
}
$hook = '_comment_' . str_replace(' ', '_', $operation);
$parameters = array(
'$comment',
);
switch ($operation) {
case 'delete':
// This block becomes example_comment_delete
break;
case 'insert':
// This block becomes example_comment_insert
break;
case 'publish':
// This block becomes example_comment_publish
break;
case 'unpublish':
// This block becomes example_comment_unpublish
break;
case 'update':
// This block becomes example_comment_update
break;
case 'validate':
// This block becomes example_comment_validate
break;
case 'view':
// This block becomes example_comment_view
break;
default:
cdp("ERROR: Invalid case value");
return;
}
// Create the new hook function.
coder_upgrade_op_to_hook($node, $case_node, $hook, $parameters);
}