function coder_upgrade_callback_block in Coder 7
Same name in this branch
- 7 coder_upgrade/conversions/other.inc \coder_upgrade_callback_block()
- 7 coder_upgrade/conversions/function.inc \coder_upgrade_callback_block()
Same name and namespace in other branches
- 7.2 coder_upgrade/conversions/other.inc \coder_upgrade_callback_block()
- 7.2 coder_upgrade/conversions/function.inc \coder_upgrade_callback_block()
Updates hook_block().
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_block'
- coder_upgrade_callback_functions in coder_upgrade/
conversions/ other.inc - Callback routine for function changes using grammar parser.
- coder_upgrade_upgrade_hook_block_alter in coder_upgrade/
conversions/ function.inc - Implements hook_upgrade_hook_block_alter().
File
- coder_upgrade/
conversions/ other.inc, line 1531 - Other conversion routine file for the coder_upgrade module.
Code
function coder_upgrade_callback_block($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 = '_block_' . str_replace(' ', '_', $operation);
$parameters = array(
'$delta',
);
switch ($operation) {
case 'configure':
// This block becomes example_block_configure
break;
case 'list':
// This block becomes example_block_list
$hook = '_block_info';
$parameters = array();
break;
case 'save':
// This block becomes example_block_save
$parameters = array(
'$delta',
'$edit',
);
break;
case 'view':
// This block becomes example_block_view
break;
default:
cdp("ERROR: Invalid case value");
return;
}
// Create the new hook function.
coder_upgrade_op_to_hook($node, $case_node, $hook, $parameters);
}