Wrap the question Next/Back buttons in a DIV for easier styling

incrn8 - June 11, 2009 - 04:25
Project:Quiz
Version:6.x-3.x-dev
Component:Code - Multichoice
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

We had a need to do some styling to the Back and Next buttons, but required a DIV wrapper around all the buttons. Unfortunately, the place where the output is generated is not in a theme function, so we had to manually add in some markup form elements into the multichoice module's code. I thought I would share our patch in case others found it useful, and maybe it would be added to the module for future releases :)

#1

incrn8 - June 11, 2009 - 04:26

Patch is against the June 9, 2009 dev release.

AttachmentSize
quiz-multichoice-navigation-wrapper-488290.patch 786 bytes

#2

mbutcher - July 6, 2009 - 18:06

You should be able to theme the form by creating theme_multichoice_render_question_form(), right?

#3

incrn8 - September 1, 2009 - 18:26
Status:needs review» fixed

Ah, yes, you're right. I had to figure out that forms are inherently themeable in D6 using the themename_theme() function in template.php (just in case anyone else is interested), along with a themename_preprocess_FORM_ID function and a tpl.php file of your choosing (defined in themename_theme().

In the end, however, I used hook_form_multichoice_render_question_form_alter(&$form, $form_state) to add a #prefix and #suffix. This was because we are switching themes on the site, and doing it this way allows me to have one module for all sites, instead of editing each theme's template.php file etc. (I know about sub-themes, but the themer for the site doesn't like to use them).

#4

System Message - September 15, 2009 - 18:30
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.