I am working on a site with Drupal commerce, I use the Bootstrap theme and a child theme.
I would like the [add-to-cart] button to have the "btn-default" class, instead of “btn-success". Actually, I want to get rid of the "info" and "warning" classes in many cases where I don't need them and replace them by "default" or "primary".
I saw in /sites/all/themes/bootstrap/bootstrap.api.php
/**
* Allows sub-themes to alter the array used for colorizing text.
* …
* @see _bootstrap_colorize_text()
*/
function hook_bootstrap_colorize_text_alter(array &$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';
}
So I tried in /sites/all/themes/[my-sub-theme]/template.php
function hook_[my-sub-theme]_colorize_text_alter(array &$texts) {
// Let's try a dummy change for a test
$texts['contains'][t('Update cart')] = 'success';
}
But I can't see anything changed.
I also saw that /sites/all/themes/bootstrap/includes/common.inc sets a number of values based on the contained string, in which I find th “Update” I am looking for. the function is
function _bootstrap_colorize_text($string, $default = '') {…}
it ends with
// Allow sub-themes to alter this array of patterns.
drupal_alter('bootstrap_colorize_text', $texts);
But I still haven't found how to do what I want in my sub theme. and what I read in /sites/all/themes/bootstrap/templates/system/buttons.vars.php won't help me.
Can somebody please explain where to start?