You are here

function skinr_ajax_index_handler in Skinr 6.2

Skinr form index handler for ajax form.

Parameters

$op: What kind of action is being performed. Possible values:

  • "form": the form elements for Skinr are being inserted in a form
  • "submit": the form has been submitted.

&$form:

  • For "form", passes in the $form parameter from hook_form_alter().
  • For "submit", passes in the $form parameter from hook_form_submit().

$form_state:

  • For "form", passes in the $form_state parameter from hook_form_alter().
  • For "submit", passes in the $form_state parameter from hook_form_submit().

Return value

The index where we can find our values in Skinrs data structure.

8 string references to 'skinr_ajax_index_handler'
block_skinr_config in modules/block.skinr.inc
Implementation of hook_skinr_config().
comment_skinr_config in modules/comment.skinr.inc
Implementation of hook_skinr_config().
content_skinr_config in modules/content.skinr.inc
Implementation of hook_skinr_config().
fieldgroup_skinr_config in modules/fieldgroup.skinr.inc
Implementation of hook_skinr_config().
node_skinr_config in modules/node.skinr.inc
Implementation of hook_skinr_config().

... See full list

File

./skinr.handlers.inc, line 46
Defines the various handler objects to support Skinr.

Code

function skinr_ajax_index_handler($op, &$form, $form_state) {
  switch ($op) {
    case 'form':
      if (empty($form['skinr']['sid']['#value'])) {
        trigger_error(sprintf("The form with form_id '%s' is not a valid AJAX form.", $form['form_id']['#value']), E_USER_ERROR);
        return FALSE;
      }
      return $form['skinr']['sid']['#value'];
    case 'submit':
      if (empty($form_state['values']['sid'])) {
        trigger_error(sprintf("The form with form_id '%s' is not a valid AJAX form.", $form['form_id']['#value']), E_USER_ERROR);
        return FALSE;
      }
      return $form_state['values']['sid'];
  }
}