You are here

function demo_manage_form in Demonstration site (Sandbox / Snapshot) 7

Same name and namespace in other branches
  1. 6 demo.admin.inc \demo_manage_form()

Form builder to manage snapshots.

1 string reference to 'demo_manage_form'
demo_menu in ./demo.module
Implements hook_menu().

File

./demo.admin.inc, line 51
Demonstration Site administrative pages.

Code

function demo_manage_form($form, &$form_state) {
  $form['status'] = array(
    '#type' => 'container',
    '#title' => t('Status'),
    '#attributes' => array(
      'class' => array(
        'demo-status',
        'clearfix',
      ),
    ),
    '#attached' => array(
      'css' => array(
        drupal_get_path('module', 'demo') . '/demo.admin.css',
      ),
    ),
  );
  $reset_date = variable_get('demo_reset_last', 0);
  $form['status']['reset_last'] = array(
    '#type' => 'item',
    '#title' => t('Last reset'),
    '#markup' => $reset_date ? format_date($reset_date) : t('Never'),
  );
  $form['dump'] = demo_get_dumps();
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['delete'] = array(
    '#type' => 'submit',
    '#value' => t('Delete'),
    '#submit' => array(
      'demo_manage_delete_submit',
    ),
  );

  // If there are no snapshots yet, hide the selection and form actions.
  if (empty($form['dump']['#options'])) {
    $form['dump']['#access'] = FALSE;
    $form['actions']['#access'] = FALSE;
  }
  return $form;
}