Theming Foundation 4 Submit Button

Here's how I lost 3 hours. In using a comination of these modules with the Drupal Foundation theme. I wanted a small search button aligned right in the right sidebar. See http://mobilemaps-dev-proxy.ucsc.edu.

  • search api
  • search api autocomplete
  • search api live results
  • Foundation 4 theme

 

function zurb_maps_form_alter(&$form, &$form_state, $form_id) {
  // Sexy submit buttons
  if (!empty($form['actions']) && !empty($form['actions']['submit'])) {
    $form['actions']['submit']['#attributes'] = array('class' => array('primary', 'button', 'radius', 'right'));
  }
  if ($form_id == 'search_api_page_search_form_search_page_live_results') {
    $form['actions']['submit']['#attributes'] = array('class' => array('secondary', 'button', 'radius', 'right'));
    $form['submit_5']['#attributes'] = array('class' => array('small', 'right'));
    echo '<pre>';
    print_r($form);
    echo '</pre>';
  }
}
 
The real trick was to output the $form variable and keep trying to set attributes for the various arrays within the $form array.

Add new comment

By submitting this form, you accept the Mollom privacy policy.