function hook_bootstrap_colorize_text_alter in Express 8
Allows sub-themes to alter the array used for colorizing text.
Parameters
array $texts: An associative array containing the text and classes to be matched, passed by reference.
See also
\Drupal\bootstrap\Bootstrap::cssClassFromString()
1 function implements hook_bootstrap_colorize_text_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- bootstrap_bootstrap_colorize_text_alter in themes/
contrib/ bootstrap/ bootstrap.theme
1 invocation of hook_bootstrap_colorize_text_alter()
- Bootstrap::cssClassFromString in themes/
contrib/ bootstrap/ src/ Bootstrap.php - Matches a Bootstrap class based on a string value.
File
- themes/
contrib/ bootstrap/ bootstrap.api.php, line 22 - List of available procedural hook and alter APIs for use in your sub-theme.
Code
function hook_bootstrap_colorize_text_alter(&$texts) {
// This matches the exact string: "My Unique Button Text".
$texts['matches'][t('My Unique Button Text')] = 'primary';
// This would also match the string above, however the class returned would
// also be the one above; "matches" takes precedence over "contains".
$texts['contains'][t('Unique')] = 'notice';
// Remove matching for strings that contain "apply":
unset($texts['contains'][t('Apply')]);
// Change the class that matches "Rebuild" (originally "warning"):
$texts['contains'][t('Rebuild')] = 'success';
}