You are here

function skinr_ui_preprocess in Skinr 7.2

Implements hook_preprocess().

1 string reference to 'skinr_ui_preprocess'
skinr_panels_theme_registry_alter in skinr_panels/skinr_panels.module
Implements hook_theme_registry_alter().

File

./skinr_ui.module, line 314
Handles Skinr UI functionality allowing users to apply skins to their site.

Code

function skinr_ui_preprocess(&$variables, $hook) {
  $original_hook = $hook;
  $theme_registry = theme_get_registry();
  if (isset($theme_registry[$hook]['original hook'])) {
    $original_hook = $theme_registry[$hook]['original hook'];
  }
  $contextual_links = array();
  $counter = 0;
  $array_elements = skinr_invoke_all('skinr_elements', $variables, $original_hook, 'contextual_links');
  foreach ($array_elements as $module => $elements) {
    foreach ($elements as $element) {
      if (!skinr_ui_element_is_skinable($module, $element)) {

        // If element is not skinable, don't add contextual link.
        continue;
      }
      $contextual_links['skinr-' . $module . '-' . $counter++] = array(
        'admin/structure/skinr/edit',
        array(
          $module,
          $element,
        ),
      );
      if ($element == 'html') {
        drupal_add_css("body.contextual-links-region { position:static; }", array(
          'type' => 'inline',
        ));
      }
    }
  }
  if (!empty($contextual_links)) {
    skinr_ui_contextual_links($variables, $original_hook, $contextual_links);
  }
  return;
}