File tree Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Drupal \wxt_bootstrap \Plugin \Preprocess ;
4+
5+ use Drupal \bootstrap \Plugin \Preprocess \InputButton as BootstrapInputButton ;
6+ use Drupal \bootstrap \Utility \Element ;
7+ use Drupal \bootstrap \Utility \Variables ;
8+
9+ /**
10+ * Pre-processes variables for the "input__button" theme hook.
11+ *
12+ * @ingroup plugins_preprocess
13+ *
14+ * @BootstrapPreprocess("input__button")
15+ */
16+ class InputButton extends BootstrapInputButton {
17+
18+ /**
19+ * {@inheritdoc}
20+ */
21+ public function preprocessElement (Element $ element , Variables $ variables ) {
22+ $ wxt = \Drupal::service ('wxt_library.service_wxt ' );
23+ $ wxt_active = $ wxt ->getLibraryName ();
24+
25+ $ element ->colorize ();
26+ $ element ->setButtonSize ();
27+ $ element ->setIcon ($ element ->getProperty ('icon ' ));
28+ $ variables ['icon_only ' ] = $ element ->getProperty ('icon_only ' );
29+ $ variables ['icon_position ' ] = $ element ->getProperty ('icon_position ' );
30+ $ variables ['label ' ] = $ element ->getProperty ('value ' );
31+ $ variables ['wxt_theme ' ] = $ wxt_active ;
32+
33+ if ($ element ->getProperty ('split ' )) {
34+ $ variables ->map ([$ variables ::SPLIT_BUTTON ]);
35+ }
36+
37+ parent ::preprocessElement ($ element , $ variables );
38+ }
39+
40+ }
Original file line number Diff line number Diff line change 3232 %}
3333 {% block input %}
3434 {% if search_submit == ' true' %}
35- <button {{ attributes.addClass (classes ) }}>{{ icon }}<span class =" wb-inv" >{{ ' Search' | t }}</span ></button >{{ children }}
35+ {% if wxt_theme == ' gcweb' %}
36+ <button {{ attributes.addClass (classes ) }}>{{ icon }}<span class =" wb-inv" >{{ ' Search' | t }}</span ></button >{{ children }}
37+ {% else %}
38+ <button {{ attributes.addClass (classes ) }}>{{ icon }}{{ ' Search' | t }}</button >{{ children }}
39+ {% endif %}
3640 {% elseif icon and icon_only %}
3741 <button {{ attributes.addClass (classes , ' icon-only' ) }}>
3842 <span class =" sr-only" >{{ label }}</span >
You can’t perform that action at this time.
0 commit comments