You are here

function coder_upgrade_callback_comment in Coder 7

Same name in this branch
  1. 7 coder_upgrade/conversions/other.inc \coder_upgrade_callback_comment()
  2. 7 coder_upgrade/conversions/function.inc \coder_upgrade_callback_comment()
Same name and namespace in other branches
  1. 7.2 coder_upgrade/conversions/other.inc \coder_upgrade_callback_comment()
  2. 7.2 coder_upgrade/conversions/function.inc \coder_upgrade_callback_comment()

Updates hook_comment().

ADD THIS TO: 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_comment'
coder_upgrade_callback_functions in coder_upgrade/conversions/other.inc
Callback routine for function changes using grammar parser.
coder_upgrade_upgrade_hook_comment_alter in coder_upgrade/conversions/function.inc
Implements hook_upgrade_hook_comment_alter().

File

coder_upgrade/conversions/function.inc, line 1400
Provides conversion routines applied to functions (or hooks).

Code

function coder_upgrade_callback_comment($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 = '_comment_' . str_replace(' ', '_', $operation);
  $parameters = array(
    '$comment',
  );
  switch ($operation) {
    case 'delete':

      // This block becomes example_comment_delete
      break;
    case 'insert':

      // This block becomes example_comment_insert
      break;
    case 'publish':

      // This block becomes example_comment_publish
      break;
    case 'unpublish':

      // This block becomes example_comment_unpublish
      break;
    case 'update':

      // This block becomes example_comment_update
      break;
    case 'validate':

      // This block becomes example_comment_validate
      break;
    case 'view':

      // This block becomes example_comment_view
      break;
    default:
      cdp("ERROR: Invalid case value");
      return;
  }

  // Create the new hook function.
  coder_upgrade_op_to_hook($node, $case_node, $hook, $parameters);
}