I have enabled/uncomented the following code in template.php of my subtheme:

function mopfoundationfive_form_alter(&$form, &$form_state, $form_id) {
//  // Sexy submit buttons
  if (!empty($form['actions']) && !empty($form['actions']['submit'])) {
    $classes = (is_array($form['actions']['submit']['#attributes']['class']))
      ? $form['actions']['submit']['#attributes']['class']
      : array();
    $classes = array_merge($classes, array('primary', 'small', 'button', 'radius'));
    $form['actions']['submit']['#attributes']['class'] = $classes;
  }

I have just changed the classes in line 7 above. When the above code is rendered in browser the primary coloured small button does not show up. The firebug shows the following html:

<button type="submit" value="Submit" name="op" id="edit-submit" class="secondary button radius primary small button radius form-submit">Submit</button>

the classes secondary button radius should not show up as they were the default classes form the uncommented version of the code.

Comments

kevinquillen’s picture

Assigned: Unassigned » kevinquillen
beachston’s picture

I also encountered this problem. If you look in the preprocess function above the form alter in your template.php, you will see where that extra 'secondary' and 'button' classes are being added:

function mopfoundationfive_preprocess_button(&$variables) {
 $variables['element']['#attributes']['class'][] = 'button';
 if (isset($variables['element']['#parents'][0]) && $variables['element']['#parents'][0] == 'submit') {
   $variables['element']['#attributes']['class'][] = 'secondary';
 }
}

Commenting out this function removed the extra classes for me.

kevinquillen’s picture

Yes, it is a little confusing. The classes are applied out of the box for those, so no further action is necessary.

The button classes are added in by default from the parent theme in form.inc. The boilerplate code is commented out, indicating that to add it in, you uncomment it, which is not the case.

I will remove the boilerplate code because it really isn't necessary to have until you're ready to override. It just makes it confusing.

kevinquillen’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.