theme_form_element

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/form.inc, строка 2190

Версии
5 – 6
theme_form_element($element, $value)

Возвращает темизированный элемент формы.

Параметры

element Ассоциативный массив, содержащий свойства элемента. Обычно используются: title, description, id, required.

$value Значение элемента.

Возвращаемое значение

Строка, представляющая элемент формы.

Связанные темы

▾ 13 функции вызывают theme_form_element()

theme_checkbox in includes/form.inc
Темизирует чекбокс.
theme_checkboxes in includes/form.inc
Изменяет стиль сразу нескольких чекбоксов.
theme_date in includes/form.inc
Форматирует дату выбранного элемента.
theme_file in includes/form.inc
Форматирует поле загрузки файла.
theme_item in includes/form.inc
Возвращает темизированный элемент формы.
theme_password in includes/form.inc
Форматирует поле ввода пароля.
theme_password_confirm in includes/form.inc
Форматирует пункт подтверждения пароля.
theme_phonenumber in developer/examples/example_element.module
Theme function to format the output.
theme_radio in includes/form.inc
Форматирует одиночный переключатель (радио-кнопку) для их группы.
theme_radios in includes/form.inc
Форматирует сразу несколько радио-кнопок.
theme_select in includes/form.inc
Format a dropdown menu or scrolling selection box.
theme_textarea in includes/form.inc
Форматирует многострочное текстовое поле ввода для формы.
theme_textfield in includes/form.inc
Форматирует однострочное текстовое поле ввода.

Код

<?php
function theme_form_element($element, $value) {
  // This is also used in the installer, pre-database setup.
  $t = get_t();

  $output = '<div class="form-item"';
  if (!empty($element['#id'])) {
    $output .= ' id="'. $element['#id'] .'-wrapper"';
  }
  $output .= ">\n";
  $required = !empty($element['#required']) ? '<span class="form-required" title="'. $t('This field is required.') .'">*</span>' : '';

  if (!empty($element['#title'])) {
    $title = $element['#title'];
    if (!empty($element['#id'])) {
      $output .= ' <label for="'. $element['#id'] .'">'. $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) ."</label>\n";
    }
    else {
      $output .= ' <label>'. $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) ."</label>\n";
    }
  }

  $output .= " $value\n";

  if (!empty($element['#description'])) {
    $output .= ' <div class="description">'. $element['#description'] ."</div>\n";
  }

  $output .= "</div>\n";

  return $output;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему