You are here

function theme_theming_example_select_form in Examples for Developers 7

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

theming_example/theming_example.module, line 335
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 .= drupal_render_children($form);
  return $output;
}