$theme) { if ((isset($theme['widgets']) && count($theme['widgets'])) || isset($theme['advanced']['_additional'])) { $hook = $module; $key = skinr_handler('form_index_handler', 'submit', $form_settings['index_handler'], $form, $form_state); $value = array(); if (isset($theme['widgets']) && is_array($theme['widgets'])) { foreach ($theme['widgets'] as $skin_id => $skin_value) { $value[$skin_id] = is_array($skin_value) ? _skinr_array_strip_empty($skin_value) : $skin_value; } } if (isset($theme['advanced']['_additional'])) { $theme['advanced']['_additional'] = trim($theme['advanced']['_additional']); if (!empty($theme['advanced']['_additional'])) { $value['_additional'] = $theme['advanced']['_additional']; } } if (isset($theme['advanced']['_template'])) { $theme['advanced']['_template'] = trim($theme['advanced']['_template']); if (!empty($theme['advanced']['_template'])) { $value['_template'] = $theme['advanced']['_template']; } } if (empty($key)) { // We didn't receive a valid key, so raise an error drupal_set_message(t("Skinr settings weren't saved due to an error."), 'error'); } skinr_set($theme_name, $hook, $key, $value); } } } /** * Helper function to remove unchecked entries from checkbox form element. */ function _skinr_array_strip_empty($array) { $new_array = array(); foreach ($array as $key => $value) { if (!empty($value)) { $new_array[$key] = $value; } } return $new_array; } // Declare API compatibility on behalf of core modules: /** * Implementation of hook_skinr_api(). * * This one is used as the base to reduce errors when updating. */ function skinr_skinr_api() { return array( 'api' => 1, 'path' => drupal_get_path('module', 'skinr') .'/modules', ); } function block_skinr_api() { return skinr_skinr_api(); } function comment_skinr_api() { return skinr_skinr_api(); } function node_skinr_api() { return skinr_skinr_api(); } function panels_skinr_api() { return skinr_skinr_api(); } function views_skinr_api() { return skinr_skinr_api(); }