You are here

function customerror_get_theme in Customerror 8

Same name and namespace in other branches
  1. 6 customerror.module \customerror_get_theme()

Gets the configured display theme for the given error code.

Parameters

int $code: The code of error.

Return value

sting $theme The name of theme.

1 call to customerror_get_theme()
CustomErrorController::index in src/Controller/CustomErrorController.php
This is the method that will get called, with the services above already available.

File

./customerror.module, line 81
Enables custom 404 (not found) and 403 (access denied) pages in Drupal with no need for creating real nodes under taxonomies.

Code

function customerror_get_theme($code = 404) {
  $theme_default = \Drupal::config('system.theme')
    ->get('admin');
  $customerror_theme = \Drupal::config('customerror.config')
    ->get("customerror_{$code}.theme");
  $theme = !empty($customerror_theme) ? $customerror_theme : $theme_default;
  return $theme;
}