1 theming_example.module theme_theming_example_select_form($variables)

Theming a simple form.

Since our form is named theming_example_select_form(), the default #theme function applied to is will be 'theming_example_select_form' if it exists. The form could also have specified a different #theme.

Here we collect the title, theme it manually and empty the form title. We also wrap the form in a div.

Related topics

File

modules/examples/theming_example/theming_example.module, line 337
Explains how a module declares theme functions, preprocess functions, and templates.

Code

function theme_theming_example_select_form($variables) {
  $form = $variables['form'];
  $title = $form['choice']['#title'];
  $form['choice']['#title'] = '';
  $output = '<strong>' . $title . '</strong>';
  $form['choice']['#prefix'] = '<div class="container-inline">';
  $form['submit']['#suffix'] = '</div>';
  $output .= backdrop_render_children($form);
  return $output;
}