You are here

function skinr_skin_extract in Skinr 6.2

2 calls to skinr_skin_extract()
skinr_preprocess in ./skinr.module
Implementation of hook_preprocess().
skinr_ui_form_submit in ./skinr_ui.module
Submit handler.

File

./skinr.module, line 98

Code

function skinr_skin_extract($module, $sids, $settings, $theme = NULL, $reset = FALSE) {
  if (empty($sids)) {
    return FALSE;
  }
  if (!is_array($sids)) {
    $sids = array(
      $sids,
    );
  }
  if (is_null($theme)) {
    $theme = skinr_current_theme();
  }
  $info = skinr_skin_data();
  $extracted = array(
    'module' => $module,
    'sids' => $sids,
    'classes' => array(),
    'css' => array(),
    'js' => array(),
    'template' => array(),
  );
  $skins = array();
  foreach ($sids as $sid) {
    if ($skinr = skinr_get($theme, $module, $sid, $reset)) {
      $skins = $skinr->skins + $skins;
    }

    // Only need to reset the first time.
    $reset = FALSE;
  }

  // Allow other modules to alter the skinr skins array.
  // @todo Fix this to work with skinr ui.
  drupal_alter('skinr_skins', $skins, $module, $sids, $settings);
  $extracted['css'] = skinr_skin_get_files($skins, 'css', $theme);
  $extracted['js'] = skinr_skin_get_files($skins, 'js', $theme);

  // Add template files.
  if (!empty($skins['_template'])) {
    $extracted['template'] = $skins['_template'];
    unset($skins['_template']);
  }
  $extracted['classes'] = skinr_flatten_skins_array($skins);
  return $extracted;
}