How do I correctly implement hook_bootstrap_colorize_text() to alter button colors in a Bootstrap sub-theme? I have read similar questions on here, but I'm still struggling for an answer for this.

I'm trying to implement hook_bootstrap_colorize_text() to alter button colors in a Bootstrap sub-theme.

I would like to add some specific text items to the array that dictates how the buttons are colorizes. For example, I have some buttons that have the  "btn-default" class, and I would like to indicate specific texts to which should have “btn-success" or "btn-warning" instead.

The bootstrap.api.php describes this process:

/**
 * Allows sub-themes to alter the array used for colorizing text.
 * …
 * @see _bootstrap_colorize_text()
 */
 function hook_bootstrap_colorize_text_alter(array &amp;$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';
}


Therefore, I have attempted to implement the following code in my sub-theme (methodsTheme) template.php file without success.

&lt;?php
// Implements hook_bootstrap_colorize_text_alter() to alter button colors.
  function methodstheme_bootstrap_colorize_text_alter(array &amp;$texts) {
    $texts['matches'][t('Request Rotation')] = 'success';
    $texts['contains'][t('Notify')] = 'success';
    $texts['contains'][t('Set')] = 'success';
    $texts['contains'][t('Mark')] = 'success';
    $texts['contains'][t('Assign')] = 'success';
    $texts['contains'][t('Report')] = 'warning';
    $texts['contains'][t('Request')] = 'info';
  }
?&gt;


I've also tried:

&lt;?php
// Implements hook_bootstrap_colorize_text_alter() to alter button colors.
  function methodstheme_bootstrap_colorize_text_alter(&amp;$texts) {
    $texts['matches'][t('Request Rotation')] = 'success';
    $texts['contains'][t('Notify')] = 'success';
    $texts['contains'][t('Set')] = 'success';
    $texts['contains'][t('Mark')] = 'success';
    $texts['contains'][t('Assign')] = 'success';
    $texts['contains'][t('Report')] = 'warning';
    $texts['contains'][t('Request')] = 'info';
  }
?&gt;


And, I've also tried:

&lt;?php
// Implements hook_bootstrap_colorize_text_alter() to alter button colors.
  function methodstheme_bootstrap_colorize_text_alter(&amp;$texts) {
    $texts = array(
      'matches' =&gt; array(
        t('Request Rotation') =&gt; 'success',
      ),
      'contains' =&gt; array(
        t('Notify') =&gt; 'success',
        t('Set') =&gt; 'success',
        t('Mark') =&gt; 'success',
        t('Assign') =&gt; 'success',
        t('Report') =&gt; 'warning',
        t('Request') =&gt; 'info',
      ),
    );
  }
?&gt;


And, yes, after each attempt, I'm clearing the caches to see if the changes to the code are implemented to the desired result. However, I'm still emptyhanded. I'm placing the template.php file in my sites/all/themes/methodstheme/templates folder. The sub-theme was already established and working well (i.e., it is set-up properly, I believe).

I'm using Drupal 7.64 (with install profile varbase, but I've mostly removed all usage of the varbase profile and modules) and latest version of Bootstrap 3 theme as the base theme.

Can anyone offer some help or suggestions on what the issue may be?
Well, I really thought I had tried everything before posting. I didn't think I'd be answering my own question, but I'll put it up here in the case it is helpful to others. Here is what eventually worked for me:

&lt;?php
  //Implements hook_bootstrap_colorize_text_alter() to alter Bootstrap button colors.
  function methodstheme_bootstrap_colorize_text_alter(&amp;$texts) {
    $texts['matches'][t('Request Rotation')] = 'success';
    $texts['contains'][t('Notify')] = 'success';
    $texts['contains'][t('Set')] = 'success';
    $texts['contains'][t('Mark')] = 'success';
    $texts['contains'][t('Assign')] = 'success';
    $texts['contains'][t('Report')] = 'warning';
    $texts['contains'][t('Request')] = 'info';
  }
?&gt;


I had tried this earlier, and had no result after clearing caches. I had tried  placing the template.php file in my sites/all/themes/methodstheme/templates folder as well as the sites/all/themes/methodstheme (not the templates sub-folder) folder. 

Regardless of the folder I placed it in, it was still not working - I had no result after clearing the caches initially.

Placing the file in the sites/all/themes/methodstheme (not the templates sub-folder) folder was part of the solution. I had brushed up on the Bootstrap Starterkit file structure, and I was fairly certain the template.php file should not be in the templates sub-folder, so I started trying other things. Using Drush I cleared the theme-registry cache, the theme list cache, then cleared all caches. I cleared those caches again a second time, and viola! My site is now functioning as expected.

Lesson learned - clearing caches multiple times is sometimes necessary/helpful!