You are here

function page_skinr_form_index_handler in Skinr 6.2

Skinr form index handler.

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 Skinr's data structure.

Related topics

1 string reference to 'page_skinr_form_index_handler'
skinr_skinr_config in modules/skinr.skinr.inc
Implementation of hook_skinr_config().

File

modules/skinr.skinr.inc, line 53
Provide skinr handling for page level rules.

Code

function page_skinr_form_index_handler($op, &$form, $form_state) {
  switch ($op) {
    case 'form':
      if (!empty($form['rule']['rid']['#value'])) {
        return $form['rule']['rid']['#value'];
      }
      else {
        return 0;
      }
    case 'submit':
      if (!empty($form_state['values']['rid'])) {
        return $form_state['values']['rid'];
      }
      else {

        // This is a rule, so we need to fetch the rid from DB.
        return db_last_insert_id('skinr_rules', 'rid');
      }
  }
}