file bootstrap.api.php

  1. 8 bootstrap.api.php
  2. 7 bootstrap.api.php

List of available procedural hook and alter APIs for use in your sub-theme.

Source
  1. <?php
  2. /**
  3. * @file
  4. * List of available procedural hook and alter APIs for use in your sub-theme.
  5. */
  6. /**
  7. * @addtogroup plugins_alter
  8. *
  9. * @{
  10. */
  11. /**
  12. * Allows sub-themes to alter the array used for colorizing text.
  13. *
  14. * @param array $texts
  15. * An associative array containing the text and classes to be matched, passed
  16. * by reference.
  17. *
  18. * @see \Drupal\bootstrap\Bootstrap::cssClassFromString()
  19. */
  20. function hook_bootstrap_colorize_text_alter(&$texts) {
  21. // This matches the exact string: "My Unique Button Text".
  22. $texts['matches'][t('My Unique Button Text')] = 'primary';
  23. // This would also match the string above, however the class returned would
  24. // also be the one above; "matches" takes precedence over "contains".
  25. $texts['contains'][t('Unique')] = 'notice';
  26. // Remove matching for strings that contain "apply":
  27. unset($texts['contains'][t('Apply')]);
  28. // Change the class that matches "Rebuild" (originally "warning"):
  29. $texts['contains'][t('Rebuild')] = 'success';
  30. }
  31. /**
  32. * Allows sub-themes to alter the array used for associating an icon with text.
  33. *
  34. * @param array $texts
  35. * An associative array containing the text and icons to be matched, passed
  36. * by reference.
  37. *
  38. * @see \Drupal\bootstrap\Bootstrap::glyphiconFromString()
  39. */
  40. function hook_bootstrap_iconize_text_alter(&$texts) {
  41. // This matches the exact string: "My Unique Button Text".
  42. $texts['matches'][t('My Unique Button Text')] = 'heart';
  43. // This would also match the string above, however the class returned would
  44. // also be the one above; "matches" takes precedence over "contains".
  45. $texts['contains'][t('Unique')] = 'bullhorn';
  46. // Remove matching for strings that contain "filter":
  47. unset($texts['contains'][t('Filter')]);
  48. // Change the icon that matches "Upload" (originally "upload"):
  49. $texts['contains'][t('Upload')] = 'ok';
  50. }
  51. /**
  52. * @} End of "addtogroup".
  53. */

Functions

Namesort descending Description
hook_bootstrap_colorize_text_alter Allows sub-themes to alter the array used for colorizing text.
hook_bootstrap_iconize_text_alter Allows sub-themes to alter the array used for associating an icon with text.