You are here

function your_module_name_upgrade_hook_hook_name_alter in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_upgrade/coder_upgrade.api.php \your_module_name_upgrade_hook_hook_name_alter()

Implements hook_upgrade_hook_HOOK_NAME_alter().

File

coder_upgrade/coder_upgrade.api.php, line 475
Documents hooks provided by this module.

Code

function your_module_name_upgrade_hook_hook_name_alter(&$node, &$reader) {
  global $_coder_upgrade_module_name;

  // Get the function object.
  $item =& $node->data;

  // Rename the function.
  $item->name = $_coder_upgrade_module_name . '_new_hook_name';

  // Update the document comment.
  $item->comment['value'] = preg_replace('@\\* Implement\\s+@', "* Implements ", $item->comment['value']);
  if ($item
    ->parameterCount() > 1) {

    // Switch the first two parameters.
    $p0 = $item
      ->getParameter(0);
    $p1 = $item
      ->getParameter(1);
    $item
      ->setParameter(0, $p1);
    $item
      ->setParameter(1, $p0);
  }
}