You are here

function skinr_panels_skinr_preprocess_alter in Skinr 8.2

Same name and namespace in other branches
  1. 7.2 skinr_panels/skinr_panels.module \skinr_panels_skinr_preprocess_alter()

Implements hook_skinr_preprocess_alter().

File

skinr_panels/skinr_panels.module, line 88
Provides Skinr integration with Panels.

Code

function skinr_panels_skinr_preprocess_alter(&$skins, $context) {
  if (module_exists('skinr_context') && ($context['hook'] == 'panels_pane' || _skinr_panels_is_panel() && $context['hook'] == 'block')) {
    foreach ($skins as $key => $skin) {
      if (!empty($skin->gid) && ($group = skinr_context_group_load($skin->gid))) {

        // Set group based weight on skins.
        $skin->weight = $group->weight;
      }
    }

    // Reorder by weight.
    uasort($skins, 'skinr_context_sort_weight');

    // Set placeholders.
    foreach ($skins as $skin) {
      $placeholder = skinr_panels_set_skin_options($skin);
      $context['variables']['classes_array'][] = $placeholder;
    }

    // Don't pass along any skins. We'll process them later.
    $skins = array();
  }
}