Score:1

Botton webform change bootstrap class

br flag

Maybe someone knows why when you change the name of the button, its class changes from btn-primary to btn-default. btn-primary only if there is a submit in the button name (Without spaces before or after).

cn flag
Because that's how the bootstrap theme is coded. There's a preprocess function which checks the button label and applies a class based on it.
Павел Герасюта avatar
br flag
Where exactly is this function implemented?
cn flag
In includes/common.inc (`_bootstrap_colorize_button()`)
Score:2
br flag

Thank you so much for Clive help. As it turned out, the _bootstrap_colorize_button function is responsible for choosing which class will be assigned depending on the label. To add a new word to this function, you need to implement hook_bootstrap_colorize_text_alter(). My code.

function myTheme_bootstrap_colorize_text_alter(array &$texts){
  $texts['contains'][t('Register')] = 'primary';
}

Instead of t ('Register'), you need the word and assign the bootstrap class you need.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.