You are here

function date_plugin_argument_default::argument_form in Date 6

File

./date_api.views.inc, line 370
Defines date-related Views data and plugins:

Class

date_plugin_argument_default
Default argument plugin to default to the current date.

Code

function argument_form(&$form, &$form_state) {
  if (!empty($this->argument->options['granularity'])) {
    return;
  }
  else {
    $form[$this->option_name] = array(
      '#title' => t('Current date format'),
      '#description' => t('Select a format to use when creating a missing argument from the current date.'),
      '#type' => 'select',
      '#options' => array(
        'Y-m-d' => 'YYYY-MM-DD',
        'Ymd' => 'YYYYMMDD',
        'Y-m' => 'YYYY-MM',
        'Ym' => 'YYYYMM',
        'Y' => 'YYYY',
        'Y-\\Ww' => 'YYYY-W99',
        'Y\\Ww' => 'YYYYW99',
      ),
      '#default_value' => $this
        ->format(),
      '#process' => array(
        'views_process_dependency',
      ),
      '#dependency' => array(
        'radio:options[default_action]' => array(
          'default',
        ),
        'radio:options[default_argument_type]' => array(
          $this->id,
        ),
      ),
      '#dependency_count' => 2,
    );
    $this
      ->check_access($form);
  }
}