| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- /**
- * @file
- * Stub file for bootstrap_button().
- */
- /**
- * Returns HTML for a button form element.
- *
- * @param array $variables
- * An associative array containing:
- * - element: An associative array containing the properties of the element.
- * Properties used: #attributes, #button_type, #name, #value.
- *
- * @return string
- * The constructed HTML.
- *
- * @see theme_button()
- *
- * @ingroup theme_functions
- */
- function bootstrap_button($variables) {
- $element = $variables['element'];
- // Allow button text to be appear hidden.
- // @see https://www.drupal.org/node/2327437
- $text = !empty($element['#hide_text']) ? '<span class="element-invisible">' . $element['#value'] . '</span>' : $element['#value'];
- // Add icons before or after the value.
- // @see https://www.drupal.org/node/2219965
- if (!empty($element['#icon'])) {
- if ($element['#icon_position'] === 'before') {
- $text = $element['#icon'] . ' ' . $text;
- }
- elseif ($element['#icon_position'] === 'after') {
- $text .= ' ' . $element['#icon'];
- }
- }
- // This line break adds inherent margin between multiple buttons.
- return '<button' . drupal_attributes($element['#attributes']) . '>' . $text . "</button>\n";
- }
|