How do I define a different administration theme for a user and administration role in Drupal 8?
I have looked at the context module for Drupal 8. There is a problem with the context condition and the reaction theme related items are all based on the front-end themes. I need the same but for the back-end themes.
My code is the same as the context reaction code for Theme.php. I just changed the submitConfiguration()
.
/**
* {@inheritdoc}
*/
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$configuration['admin'] = $form_state->getValue('theme');
$configuration += $this->getConfiguration();
\Drupal::configFactory()
->getEditable('system.theme')
->set('admin', $form_state->getValue('theme'))
->save();
$this->setConfiguration($configuration);
}
I defined the following in the context configuration.
Condition => Role:User
Reaction => Admin Theme: Customtheme
Condition => Role: Administrator
Reaction => Admin Theme: Seven
Is this possible? Are there other methods for achieving this goal?