Moving Views Exposed Filters Form Elements Around

In Drupal 7, Views allows you to easily create exposed filters and alter a lot of the logic involved.  However, sometimes you get requests to add text to the form or position things in ways that the Views UI does not allow for.

I've got two solutions that are arguably not as Drupal-like as I would like, but I've run into some dead ends on occasion with trying to fullfill requests with only Drupal-like alterations.  And of course if there are better ways to do it, I am open to them.

The first method gives you primary control over the exposed form by using hook_form_FORM_ID_alter().  You would think it would be easy to alter the order of form elements in that hook, but it is a little complicated because of the way the form elements can have #weight but that the #info array has the final say over order.

To get around this and make it easy to juggle things around and add items to a form, I created a Drupal Views FormManipulator class.

If you need to do even more advanced juggling of form, header, footer and other views elements I have also resorted to using QueryPath & hook_views_post_render().  It gives you a lot more control, perhaps a bit more fragile if you are not careful to use stable selectors, but it does let you move things that would require lots of  different hooks, custom templates AND still leaving you with not quite 100% of what the client is asking for.