Condition by role (admin) with reaction by theme (Basic) causes partial crash

Created on 16 December 2023, over 1 year ago
Updated 17 December 2023, over 1 year ago

Drupal 10.1.7 core with only the contrib module Context installed. Administrative theme is Claro and non-administrative theme is Olivero.

I have installed a contrib theme Basic and then used Context to condition my role (admin) to react with this theme (Basic) and since then I can't use the website as an admin at all.

I get the following error in each webpage:

An unexpected error occurred. Please try again later

The website keeps working normally for non admin role users (anonymous users, regular registered users) but I as an admin can't use it.

From vendor/bin/drush watchdog:show I got this pattern:

Twig\Error\SyntaxError: Unknown "endif" tag. in Twig\Parser->subparse() (line 37 of /home/USERNAME/WEB_APPLICATION_ROOT/example.com/web/themes/contrib/basic/templates/layout/html.html.twig).

I am not sure how to proceed. I thought about just uninstalling Context this way:

vendor/bin/drush un context
composer remove 'drupal/context:^5.0@RC'

Is there a problem to do that?

A Drupal Answers discussion.

🐛 Bug report
Status

Closed: works as designed

Version

5.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @bendqh1
  • Status changed to Closed: works as designed over 1 year ago
  • As indicated by vendor/bin/drush watchdog:show the problem was in a twig file of the Basic theme because when I have changed in /themes/contrib/basic/templates/layout/html.html.twig from this:

    <!DOCTYPE html>
      <html{{ html_attributes }}>
    {% endif %}
    

    to that:

    <!DOCTYPE html>
      <html{{ html_attributes }}>
    

    I could then finally use my website as an admin and with Basic theme as a non-administrative theme unique to me as an admin.
    I then went to /admin/structure/context and manually removed the particular condition-reaction discussed here.

Production build 0.71.5 2024