You are here

function panels_skinr_data_handler in Skinr 6.2

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

Skinr data handler. This is the data that populates the skinr form.

Parameters

&$form: Passes in the $form parameter from hook_form_submit().

$form_state: Passes in the $form_state parameter from hook_form_submit().

$module: The module that is currently being processed.

$form_settings: The settings from hook_skinr_config() for the form that's currently being processed.

Return value

TRUE if we get access, FALSE if we don't.

Related topics

1 string reference to 'panels_skinr_data_handler'
panels_skinr_config in modules/panels.skinr.inc
Implementation of hook_skinr_config().

File

modules/panels.skinr.inc, line 177
Provide skinr handling for panels.module.

Code

function panels_skinr_data_handler(&$form, $form_state, $theme, $module, $form_settings) {

  // Ensure we have the required index_handler.
  if (empty($form_settings['index_handler'])) {
    trigger_error(sprintf("No index_handler was found for form_id '%s' in module '%s'.", $form_id, $module), E_USER_ERROR);
  }
  $index = skinr_handler('form_index_handler', 'form', $form_settings['index_handler'], $form, $form_state);

  // Fetch skinr data for this view from cache.
  ctools_include('object-cache');
  if ($skinr_data = ctools_object_cache_get('skinr', $form_state['display']->did, TRUE)) {
    if (isset($skinr_data[$theme][$index])) {
      return $skinr_data[$theme][$index];
    }
    else {
      return array();
    }
  }

  // No data exists in cache, so let's grab it from the regular source.
  return skinr_get($theme, $module, $index);
}