You are here

function system_skinr_ui_element_options in Skinr 8.2

Same name and namespace in other branches
  1. 7.2 modules/system.skinr.inc \system_skinr_ui_element_options()

Implements hook_skinr_ui_element_options().

File

modules/system.skinr.inc, line 18
Implements Skinr hooks for system.module.

Code

function system_skinr_ui_element_options($theme_name = NULL) {
  $options = array(
    'system' => array(),
  );
  $options['system']['html'] = t('Page');
  $theme_handler = \Drupal::service('theme_handler');
  $themes = $theme_handler
    ->listInfo();
  foreach ($themes as $theme_name => $theme) {
    if (empty($theme->status)) {
      continue;
    }

    // Create a list options containing visible regions of this theme.
    $regions = array();
    foreach (system_region_list($theme_name, REGIONS_VISIBLE) as $region_name => $region) {
      $regions['region__' . $region_name] = $region;
    }

    // Group the list of options by theme.
    $key = t('@name Regions', array(
      '@name' => $theme->info['name'],
    ));
    $options['system'][$key] = $regions;
  }
  return $options;
}