You are here

function coder_upgrade_convert_form_callback in Coder 7

Same name and namespace in other branches
  1. 7.2 coder_upgrade/conversions/function.inc \coder_upgrade_convert_form_callback()
1 call to coder_upgrade_convert_form_callback()
coder_upgrade_upgrade_hook_alter in coder_upgrade/conversions/function.inc
Implements hook_upgrade_hook_alter().

File

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

Code

function coder_upgrade_convert_form_callback(&$node) {
  cdp("inside " . __FUNCTION__);
  $item =& $node->data;
  $editor = PGPEditor::getInstance();
  if (!$item
    ->parameterCount()) {

    // No parameters; insert the $form and $form_state parameters.
    $item
      ->insertParameter(0, $editor
      ->expressionToStatement('$form'));
    $item
      ->insertParameter(1, $editor
      ->expressionToStatement('&$form_state'));
    return;
  }

  // Insert the $form parameter (if not already inserted).
  $p0 = $item
    ->getParameter()
    ->stripComments()
    ->toString();

  // TODOxxx use getParameterVariable???
  if ($p0 == '&$form_state' || $p0 == '$form_state' || $p0 != '$form') {

    // if ($p0 != '$form') {
    $item
      ->insertParameter(0, $editor
      ->expressionToStatement('$form'));
  }
}