archive_browse_form

Versions
4.7
archive_browse_form($year, $month, $day)

Generate a form that retrieves archives for a certain date.

Code

modules/archive.module, line 253

<?php
function archive_browse_form($year, $month, $day) {
  // Prepare the values of the form fields.
  $years = drupal_map_assoc(range(2000, date('Y')));
  $months = array(1 => t('January'), 2 => t('February'), 3 => t('March'), 4 => t('April'), 5 => t('May'), 6 => t('June'), 7 => t('July'), 8 => t('August'), 9 => t('September'), 10 => t('October'), 11 => t('November'), 12 => t('December'));
  $days = drupal_map_assoc(range(1, 31));

  $form['year']  = array('#type' => 'select',
    '#default_value' => ($year ? $year : date('Y')),
    '#options' => $years,
  );
  $form['month'] = array('#type' => 'select',
    '#default_value' => ($month ? $month : date('m')),
    '#options' => $months,
  );
  $form['day']   = array('#type' => 'select',
    '#default_value' => ($day ? $day : date('d')),
    '#options' => $days,
  );
  $form['show']  = array('#type' => 'submit',
    '#value' => t('Show'),
  );

  return drupal_get_form('archive_browse_form', $form);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.