You are here

function comment_skinr_form_index_handler in Skinr 6.2

Same name and namespace in other branches
  1. 6 modules/comment.skinr.inc \comment_skinr_form_index_handler()

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 Skinrs data structure.

Related topics

1 string reference to 'comment_skinr_form_index_handler'
comment_skinr_config in modules/comment.skinr.inc
Implementation of hook_skinr_config().

File

modules/comment.skinr.inc, line 53
Provide skinr handling for comment.module

Code

function comment_skinr_form_index_handler($op, &$form, &$form_state) {
  switch ($op) {
    case 'form':
      return $form['#node_type']->type;
    case 'submit':

      // Clear old variable before we set a new one if the node type has changed
      if ($form_state['values']['old_type'] != $form_state['values']['type']) {
        foreach ($form_state['values']['skinr_settings']['comment_group'] as $theme_name => $theme_data) {
          $skinr = new stdClass();
          $skinr->theme = $theme_name;
          $skinr->module = 'comment';
          $skinr->sid = $form_state['values']['old_type'];
          $skinr->skins = array();
          skinr_set($skinr);
        }
      }
      return $form_state['values']['type'];
  }
}