Loading includes/form.inc +21 −13 Original line number Diff line number Diff line <?php use Drupal\Core\Template\Attribute; use Drupal\Core\Form\FormStateInterface; use Drupal\Component\Utility\Xss; /** * @file * Theme and preprocess functions for forms. */ use Drupal\Core\Form\FormStateInterface; /** * Implements hook_theme_suggestions_HOOK_alter(). Loading Loading @@ -57,11 +59,15 @@ function belgrade_preprocess_input(&$variables) { $variables['attributes']['class'][] = 'form-check-input'; } if ($type == 'submit') { $variables['attributes'] = new Attribute($variables['attributes']); if (theme_get_setting('belgrade_submit_button')) { $variables['submit_button'] = TRUE; $variables['safe_value_label'] = Xss::filter($variables['attributes']['value']); } // Get value. $string = $variables['attributes']->offsetGet('value')->value(); Loading Loading @@ -157,29 +163,32 @@ function belgrade_preprocess_input(&$variables) { ]; // Check if classes are already there $add_white_icon = true; $add_white_icon = TRUE; foreach ($classes as $class) { if ($variables['attributes']->hasClass($class)) { $add_white_icon = false; $add_white_icon = FALSE; } } // Iterate over the array. foreach ($text_data as $pattern => $strings) { foreach ($strings as $text => $class) { switch ($pattern) { case 'matches': if ($string === $text) { if (!$variables['attributes']->hasClass('btn-' . $class)) { $variables['attributes']->addClass(['btn', 'btn-' . $class]); } } break; case 'contains': if (strpos(mb_strtolower($string), mb_strtolower($text)) !== FALSE) { if (!$variables['attributes']->hasClass('btn-' . $class)) { $variables['attributes']->addClass(['btn', 'btn-' . $class]); } } break; } } Loading Loading @@ -265,7 +274,6 @@ function belgrade_theme_suggestions_container_alter(array &$suggestions, array $ } return $suggestions; } /** * Implements hook_theme_suggestions_fieldset(). Loading Loading
includes/form.inc +21 −13 Original line number Diff line number Diff line <?php use Drupal\Core\Template\Attribute; use Drupal\Core\Form\FormStateInterface; use Drupal\Component\Utility\Xss; /** * @file * Theme and preprocess functions for forms. */ use Drupal\Core\Form\FormStateInterface; /** * Implements hook_theme_suggestions_HOOK_alter(). Loading Loading @@ -57,11 +59,15 @@ function belgrade_preprocess_input(&$variables) { $variables['attributes']['class'][] = 'form-check-input'; } if ($type == 'submit') { $variables['attributes'] = new Attribute($variables['attributes']); if (theme_get_setting('belgrade_submit_button')) { $variables['submit_button'] = TRUE; $variables['safe_value_label'] = Xss::filter($variables['attributes']['value']); } // Get value. $string = $variables['attributes']->offsetGet('value')->value(); Loading Loading @@ -157,29 +163,32 @@ function belgrade_preprocess_input(&$variables) { ]; // Check if classes are already there $add_white_icon = true; $add_white_icon = TRUE; foreach ($classes as $class) { if ($variables['attributes']->hasClass($class)) { $add_white_icon = false; $add_white_icon = FALSE; } } // Iterate over the array. foreach ($text_data as $pattern => $strings) { foreach ($strings as $text => $class) { switch ($pattern) { case 'matches': if ($string === $text) { if (!$variables['attributes']->hasClass('btn-' . $class)) { $variables['attributes']->addClass(['btn', 'btn-' . $class]); } } break; case 'contains': if (strpos(mb_strtolower($string), mb_strtolower($text)) !== FALSE) { if (!$variables['attributes']->hasClass('btn-' . $class)) { $variables['attributes']->addClass(['btn', 'btn-' . $class]); } } break; } } Loading Loading @@ -265,7 +274,6 @@ function belgrade_theme_suggestions_container_alter(array &$suggestions, array $ } return $suggestions; } /** * Implements hook_theme_suggestions_fieldset(). Loading