class WebformShareThemeNegotiator in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_share/src/Theme/WebformShareThemeNegotiator.php \Drupal\webform_share\Theme\WebformShareThemeNegotiator
Sets the theme for the webform share page.
Hierarchy
- class \Drupal\webform_share\Theme\WebformShareThemeNegotiator implements ThemeNegotiatorInterface
Expanded class hierarchy of WebformShareThemeNegotiator
See also
\Drupal\webform_share\Controller\WebformShareController::page
1 string reference to 'WebformShareThemeNegotiator'
- webform_share.services.yml in modules/
webform_share/ webform_share.services.yml - modules/webform_share/webform_share.services.yml
1 service uses WebformShareThemeNegotiator
File
- modules/
webform_share/ src/ Theme/ WebformShareThemeNegotiator.php, line 16
Namespace
Drupal\webform_share\ThemeView source
class WebformShareThemeNegotiator implements ThemeNegotiatorInterface {
/**
* The system theme config object.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Constructs a WebformShareThemeNegotiator object.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
*/
public function __construct(ConfigFactoryInterface $config_factory) {
$this->configFactory = $config_factory;
}
/**
* {@inheritdoc}
*/
public function applies(RouteMatchInterface $route_match) {
return WebformShareHelper::isPage($route_match);
}
/**
* {@inheritdoc}
*/
public function determineActiveTheme(RouteMatchInterface $route_match) {
/** @var \Drupal\webform\WebformInterface $webform */
$webform = $route_match
->getParameter('webform');
return $webform
->getSetting('share_theme_name', TRUE) ?: $this->configFactory
->get('system.theme')
->get('default');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
WebformShareThemeNegotiator:: |
protected | property | The system theme config object. | |
WebformShareThemeNegotiator:: |
public | function |
Whether this theme negotiator should be used to set the theme. Overrides ThemeNegotiatorInterface:: |
|
WebformShareThemeNegotiator:: |
public | function |
Determine the active theme for the request. Overrides ThemeNegotiatorInterface:: |
|
WebformShareThemeNegotiator:: |
public | function | Constructs a WebformShareThemeNegotiator object. |