Get Theme details (Name, Regions, Libraries ...)

Get current theme.

1.$theme = \Drupal::theme()->getActiveTheme();
2.$theme = \Drupal::service('theme.manager')->getActiveTheme();
3.$theme = \Drupal::config('system.theme')->get('default');

获取后台主题名称

$admin_theme = \Drupal::config('system.theme')->get('admin');

修改主题

// Set the default theme.
\Drupal::config('system.theme')
  ->set('default', $theme)
  ->save();

Theme name:

$theme_name = \Drupal::theme()->getActiveTheme()->getName();

Theme regions list:

$theme_regions = \Drupal::theme()->getActiveTheme()->getRegions();

Theme libraries list.

$theme_libraries = \Drupal::theme()->getActiveTheme()->getLibraries();

Theme base themes list.

$theme_basethemes = \Drupal::theme()->getActiveTheme()->getBaseThemes();

System regions list.

$theme_name = \Drupal::theme()->getActiveTheme()->getName();
$system_regions_list = system_region_list($theme_name);


Visible system regions list.

$theme_name = \Drupal::theme()->getActiveTheme()->getName();
$system_regions_list = system_region_list($theme_name$show = REGIONS_VISIBLE);

drush设置后台主题

drush config-set system.theme admin seven -y

Comments

Submitted byadmin on Fri, 05/06/2016 - 18:33

Donec sed odio dui. Nulla vitae elit libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Nullam id dolor id nibh ultricies vehicula ut id elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.

Donec sed odio dui. Nulla vitae elit libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Nullam id dolor id nibh ultricies vehicula ut id elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.

Submitted byadmin on Fri, 05/06/2016 - 18:34

Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Nullam id dolor id nibh ultricies vehicula ut id elit.