You are here

function skinr_ui_form_get_defaults in Skinr 7.2

Helper function to get the default values for the skinr edit form.

Parameters

$module: The module that we're editing settings of.

$element: The element of the object we're editing settings of.

1 call to skinr_ui_form_get_defaults()
skinr_ui_edit in ./skinr_ui.edit.inc
Menu callback; prepares some variables and displays a Skinr edit form.

File

./skinr_ui.edit.inc, line 30
Page callbacks for the Skinr UI module related to editing skins.

Code

function skinr_ui_form_get_defaults($module, $element) {

  // Set defaults.
  $defaults = array();
  $themes = list_themes();
  foreach ($themes as $theme) {
    if (!$theme->status) {
      continue;
    }
    $params = array(
      'theme' => $theme->name,
      'module' => $module,
      'element' => $element,
    );

    // Don't nest the call to skinr_skin_get_sids() in skinr_skin_load_multiple().
    // If the prior functions returns no results, the second function will load
    // ALL skins.
    if ($sids = skinr_skin_get_sids($params)) {
      $skins = skinr_skin_load_multiple($sids);
      foreach ($skins as $skin) {
        $defaults[$theme->name][$skin->skin] = $skin->options;
      }
    }
  }
  return $defaults;
}