function menu_test_custom_theme

Implement hook_custom_theme().

Return value

The name of the custom theme to use for the current page.

File

drupal/core/modules/system/tests/modules/menu_test/menu_test.module, line 604
Dummy module implementing hook menu.

Code

function menu_test_custom_theme() {

  // When requested by one of the MenuTrailTestCase tests, record the initial
  // active trail during Drupal's bootstrap (before the user is redirected to a
  // custom 403 or 404 page). See menu_test_custom_403_404_callback().
  if (Drupal::state()
    ->get('menu_test.record_active_trail') ?: FALSE) {
    Drupal::state()
      ->set('menu_test.active_trail_initial', menu_get_active_trail());
  }

  // If an appropriate variable has been set in the database, request the theme
  // that is stored there. Otherwise, do not attempt to dynamically set the
  // theme.
  if ($theme = Drupal::state()
    ->get('menu_test.hook_custom_theme_name') ?: FALSE) {
    return $theme;
  }
}