You are here

function date_api_date_format_select_field in Date 6.2

Helper function; return form fields for date format selects.

2 calls to date_api_date_format_select_field()
date_api_date_format_form_elements in ./date_api.admin.inc
Add drop down selects for date format types.
date_locale_format_form in date_locale/date_locale.module
Display list of enabled languages to configure date formats for.

File

./date_api.admin.inc, line 226
Administrative page callbacks for the date_api module.

Code

function date_api_date_format_select_field(&$form, $type, $type_info, $default, $choices, $show_remove = 0) {

  // Show date format select list.
  $form['date_formats']['date_format_' . $type] = array(
    '#prefix' => '<div class="date-container"><div class="select-container">',
    // Leave the date-container div open if we are going to be adding to and
    // then closing it below.
    '#suffix' => $show_remove == 1 && $type_info['locked'] == 0 ? '</div>' : '</div></div>',
    '#type' => 'select',
    '#title' => t('!type date format', array(
      '!type' => t($type_info['title']),
    )),
    '#attributes' => array(
      'class' => 'date-format',
    ),
    '#default_value' => isset($choices[$default]) ? $default : 'custom',
    '#options' => $choices,
  );

  // If this isn't a system provided type, allow the user to remove it from
  // the system.
  if ($show_remove == 1 && $type_info['locked'] == 0) {
    $form['date_formats']['date_format_' . $type . '_delete'] = array(
      '#prefix' => '<div class="date-format-delete">',
      '#suffix' => '</div></div>',
      '#value' => l(t('remove'), 'admin/settings/date-time/delete/' . $type),
    );
  }
}