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