I have an article content type with categories (term1,term2 etc) I want to be able to theme the node view with a different theme when specific category is picked on node edit

how can this be done ? any kind of solution is acceptable

NOTE: at this point https://www.drupal.org/project/page_theme, https://www.drupal.org/project/themekey have not been ported to D8 :-( They would really be great solutions

1 Answer 1


Here is a complete solution

  1. Installing context module we can create a context which comprise of conditions which if they are met they do the specified reactions

  2. Installing entity_field_condition will let as set the desired condition

  3. Add context (lets name alternative theme section)

  4. Add Node Field (entity_field_condition) and select category name and choose the specific value that corresponds to the desired category (tid since we are talking about term reference).

  5. Add reaction theme and choose the theme that you want to be activated on above conditions

NOTES: At the time of writing this entity_field_condition needs a patch to work properly with entity reference (as is the case of category field). The patch can be found here

term condition was not working at the moment (buggy was not able to add the condition it was giving WSOD)

Alternatives would be to write my own custom condition or debug the term condition module or write my own theme negotiator

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.