You are here

function coder_upgrade_callback_nodeapi in Coder 7.2

Same name in this branch
  1. 7.2 coder_upgrade/conversions/other.inc \coder_upgrade_callback_nodeapi()
  2. 7.2 coder_upgrade/conversions/function.inc \coder_upgrade_callback_nodeapi()
Same name and namespace in other branches
  1. 7 coder_upgrade/conversions/other.inc \coder_upgrade_callback_nodeapi()
  2. 7 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/function.inc, line 1453
Provides conversion routines applied to functions (or hooks).

Code

function coder_upgrade_callback_nodeapi($node, $case_node, $operation = '') {
  cdp("inside " . __FUNCTION__);
  if (!$operation) {
    $case =& $case_node->data;
    if (!$case instanceof PGPCase || $case->type == T_DEFAULT) {
      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 $view_mode = 'print'
      $hook = '_node_view';
      $parameters = array(
        '$node',
        '$view_mode = \'print\'',
      );
      break;
    case 'rss item':

      // This block becomes example_node_view with $view_mode = 'rss'
      $hook = '_node_view';
      $parameters = array(
        '$node',
        '$view_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 $view_mode = 'full' by default
      $parameters = array(
        '$node',
        '$view_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);
}