function coder_upgrade_convert_access in Coder 7
Same name in this branch
- 7 coder_upgrade/conversions/other.inc \coder_upgrade_convert_access()
- 7 coder_upgrade/conversions/function.inc \coder_upgrade_convert_access()
Same name and namespace in other branches
- 7.2 coder_upgrade/conversions/other.inc \coder_upgrade_convert_access()
- 7.2 coder_upgrade/conversions/function.inc \coder_upgrade_convert_access()
Updates hook_access().
Replace hook_access() with hook_node_access(). Switch places of first two parameters.
Parameters
PGPNode $node: A node object containing a PGPClass (or function) item.
2 calls to coder_upgrade_convert_access()
- coder_upgrade_callback_functions in coder_upgrade/
conversions/ other.inc - Callback routine for function changes using grammar parser.
- coder_upgrade_upgrade_hook_access_alter in coder_upgrade/
conversions/ function.inc - Implements hook_upgrade_hook_access_alter().
File
- coder_upgrade/
conversions/ other.inc, line 1098 - Other conversion routine file for the coder_upgrade module.
Code
function coder_upgrade_convert_access(&$node) {
cdp("inside " . __FUNCTION__);
$item =& $node->data;
cdp($item
->print_r());
global $_coder_upgrade_module_name;
// Rename function.
$item->name = $_coder_upgrade_module_name . '_node_access';
// Update document comment.
$item->comment = preg_replace('@hook_access([^i])@', "hook_node_access\$1", $item->comment);
// Switch places of the first two parameters.
// cdp("Printing parameters");
cdp($item->parameters
->print_r());
$count = $item->parameters
->count();
// Adjust parameters.
if ($count > 1) {
// Switch places.
$p0 = $item
->getParameter(0);
$p1 = $item
->getParameter(1);
$item
->setParameter(0, $p1);
$item
->setParameter(1, $p0);
}
}