function coder_upgrade_callback_nodeapi in Coder 7
Same name in this branch
- 7 coder_upgrade/conversions/other.inc \coder_upgrade_callback_nodeapi()
- 7 coder_upgrade/conversions/function.inc \coder_upgrade_callback_nodeapi()
Same name and namespace in other branches
- 7.2 coder_upgrade/conversions/other.inc \coder_upgrade_callback_nodeapi()
- 7.2 coder_upgrade/conversions/function.inc \coder_upgrade_callback_nodeapi()
Updates hook_nodeapi().
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_nodeapi'
- coder_upgrade_callback_functions in coder_upgrade/
conversions/ other.inc - Callback routine for function changes using grammar parser.
- coder_upgrade_upgrade_hook_nodeapi_alter in coder_upgrade/
conversions/ function.inc - Implements hook_upgrade_hook_nodeapi_alter().
File
- coder_upgrade/
conversions/ other.inc, line 1632 - Other conversion routine file for the coder_upgrade module.
Code
function coder_upgrade_callback_nodeapi($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 = '_node_' . str_replace(' ', '_', $operation);
$parameters = array(
'$node',
);
switch ($operation) {
case 'alter':
// This block becomes example_node_build_alter
$hook = '_node_build_alter';
$parameters = array(
'$build',
);
break;
case 'delete':
// This block becomes example_node_delete
break;
case 'delete revision':
// This block becomes example_node_revision_delete
$hook = '_node_revision_delete';
break;
case 'insert':
// This block becomes example_node_insert
break;
case 'load':
// This block becomes example_node_load
$parameters = array(
'$node',
'$types',
);
break;
case 'prepare':
// This block becomes example_node_prepare
break;
case 'prepare translation':
// This block becomes example_node_prepare_translation
break;
case 'print':
// This block becomes example_node_view with $build_mode = 'print'
$hook = '_node_view';
$parameters = array(
'$node',
'$build_mode = \'print\'',
);
break;
case 'rss item':
// This block becomes example_node_view with $build_mode = 'rss'
$hook = '_node_view';
$parameters = array(
'$node',
'$build_mode = \'rss\'',
);
break;
case 'search result':
// This block becomes example_node_search_result
break;
case 'presave':
// This block becomes example_node_presave
break;
case 'update':
// This block becomes example_node_update
break;
case 'update index':
// This block becomes example_node_update_index
break;
case 'validate':
// This block becomes example_node_validate
$parameters = array(
'$node',
'$form',
);
break;
case 'view':
// This block becomes example_node_view with $build_mode = 'full' by default
$parameters = array(
'$node',
'$build_mode = \'full\'',
);
break;
default:
cdp("ERROR: Invalid case value");
return;
}
// Create the new hook function.
coder_upgrade_op_to_hook($node, $case_node, $hook, $parameters);
}