You are here

class SchedulerThemeNegotiator in Scheduler 8

Same name and namespace in other branches
  1. 2.x src/Theme/SchedulerThemeNegotiator.php \Drupal\scheduler\Theme\SchedulerThemeNegotiator

Defines a theme negotiator for the Scheduler routes.

Hierarchy

Expanded class hierarchy of SchedulerThemeNegotiator

1 string reference to 'SchedulerThemeNegotiator'
scheduler.services.yml in ./scheduler.services.yml
scheduler.services.yml
1 service uses SchedulerThemeNegotiator
theme.negotiator.scheduler in ./scheduler.services.yml
Drupal\scheduler\Theme\SchedulerThemeNegotiator

File

src/Theme/SchedulerThemeNegotiator.php, line 11

Namespace

Drupal\scheduler\Theme
View source
class SchedulerThemeNegotiator implements ThemeNegotiatorInterface {

  /**
   * {@inheritdoc}
   */
  public function applies(RouteMatchInterface $route_match) {

    // Use the Scheduler theme negotiator for the user 'scheduled' tab.
    $applies = $route_match
      ->getRouteName() == 'view.scheduler_scheduled_content.user_page';
    return $applies;
  }

  /**
   * {@inheritdoc}
   */
  public function determineActiveTheme(RouteMatchInterface $route_match) {

    // Return the admin theme.
    $config = \Drupal::service('config.factory')
      ->getEditable('system.theme');
    $admin_theme = $config
      ->get('admin');
    return $admin_theme;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SchedulerThemeNegotiator::applies public function Whether this theme negotiator should be used to set the theme. Overrides ThemeNegotiatorInterface::applies
SchedulerThemeNegotiator::determineActiveTheme public function Determine the active theme for the request. Overrides ThemeNegotiatorInterface::determineActiveTheme