You are here

function node_skinr_form_index_handler in Skinr 6

Same name and namespace in other branches
  1. 6.2 modules/node.skinr.inc \node_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 'node_skinr_form_index_handler'
node_skinr_data in modules/node.skinr.inc
Implementation of hook_skinr_data().

File

modules/node.skinr.inc, line 45
Provide skinr handling for node.module

Code

function node_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']['node_group'] as $theme_name => $theme_data) {
          skinr_set($theme_name, 'comment', $form_state['values']['old_type'], '');
        }
      }
      return $form_state['values']['type'];
  }
}