Dependency on old Bootstrap module

Created on 8 January 2025, 23 days ago

Problem/Motivation

We had trouble loading webforms with this module installed on a site which was using the Bootstrap5 theme. The error is:

Class "Drupal\bootstrap\Bootstrap" not found in webform_bootstrap5_webform_element_alter()

The webform maintainers according to issue https://www.drupal.org/project/webform/issues/3492971 πŸ“Œ Document webform_bootstrap deprecation Active are wanting to get the webform_bootstrap module functionality moved fully out to its own contrib module, and they have pointed out this module as being a step in that direction.

Steps to reproduce

Set up D11 site, installed Webform 6.3.0-alpha2, installed 11.0.x-dev version of webform_bootstrap5, created simple contact webform and could not view the page.

Proposed resolution

The webform_bootstrap5_webform_element_alter() function includes a call to \Drupal\bootstrap\Bootstrap::getTheme() which is failing, checking to see if the theme has something called "Smart Descriptions" enabled. I believe this section was simply copied from the webform_bootstrap submodule that has been hanging around in webform, and this depends directly on a theme with the machine name of "bootstrap". This webform_bootstrap5 module has replaced most of the references to "bootstrap" with "bootstrap5", including a check on whether "bootstrap5" is one of the active themes, so the call which verifies this succeeds before the code continues ahead with calling that missing class.

There is another function, webform_bootstrap5_preprocess_input(), which is trying to call for another static method on that class, \Drupal\bootstrap\Bootstrap::glyphicon() in order to add icons to image buttons.

I believe that this will work fine when the older 8.x-3.x version of the "Bootstrap" theme (targeting Bootstrap 3.x framework) is also installed on the same site, because that class will be available and can run. However, the "Bootstrap" maintainers have started a new release of that module targeting the Bootstrap 5.x framework after the last changes I can find with this module. Notably, the Bootstrap 5.x theme does not include a "src" directory and would not have the \Drupal\bootstrap\Bootstrap class available, it is only available in the 8.x-3.x version of that theme.

Remaining tasks

Likely these calls and associated code simply need to be removed. It might also be useful to think about also targeting the 5.x version of the Bootstrap theme, or calling out that it is not supported.

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Active

Version

11.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jaminion

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

Comments & Activities

Production build 0.71.5 2024