function coder_upgrade_new_filter_tips_hook in Coder 7.2
Same name and namespace in other branches
- 7 coder_upgrade/conversions/function.inc \coder_upgrade_new_filter_tips_hook()
1 call to coder_upgrade_new_filter_tips_hook()
- coder_upgrade_convert_filter_tips in coder_upgrade/
conversions/ function.inc - Updates hook_filter_tips().
File
- coder_upgrade/
conversions/ function.inc, line 975 - Provides conversion routines applied to functions (or hooks).
Code
function coder_upgrade_new_filter_tips_hook($node, $hook, $parameters, $body) {
// DONE
global $_coder_upgrade_module_name;
// Set values for the new hook function.
$delta = substr($hook, strrpos($hook, '_') + 1);
$comment = array(
'type' => T_DOC_COMMENT,
'value' => "/**\n * Filter tips callback function for \$filters[{$delta}] in hook_filter_info().\n */",
);
$name = $_coder_upgrade_module_name . $hook;
// Create the new hook function.
$function = new PGPClass($name);
$function->comment = $comment;
$function->type = T_FUNCTION;
$function->parameters = $parameters;
// new PGPList();
$function->body = new PGPBody();
$function->body
->insertLast($body);
// cdp($function->print_r());
// TODO REFACTOR: The following statements are repeated in other create_hook routines.
// Get the statement list the function node is part of.
$container =& $node->container;
// Insert the new function before the old function.
$new_node = $container
->insertBefore($node, $function, 'function');
// $editor = PGPEditor::getInstance();
// cdp($editor->statementsToText($new_node));
// Insert a blank line.
$whitespace = array(
'type' => T_WHITESPACE,
'value' => 1,
);
$container
->insertBefore($node, $whitespace, 'whitespace');
}