You are here

function views_autorefresh_handler_area_autorefresh::options_form in Views Auto-Refresh 7.2

Same name and namespace in other branches
  1. 7 views/views_autorefresh_handler_area_autorefresh.inc \views_autorefresh_handler_area_autorefresh::options_form()

Default options form that provides the label widget that all fields should have.

Overrides views_handler_area::options_form

File

views/views_autorefresh_handler_area_autorefresh.inc, line 45

Class

views_autorefresh_handler_area_autorefresh
Base class for area handlers.

Code

function options_form(&$form, &$form_state) {
  if (module_exists('nodejs')) {
    $form['nodejs'] = array(
      '#type' => 'checkbox',
      '#title' => t('Use Node.js to refresh the view instead of interval pings'),
      '#default_value' => $this->options['nodejs'],
    );
  }
  else {
    $form['nodejs'] = array(
      '#type' => 'value',
      '#value' => FALSE,
    );
  }
  $form['interval'] = array(
    '#type' => 'textfield',
    '#title' => t('Interval to check for new items'),
    '#default_value' => $this->options['interval'],
    '#field_suffix' => 'milliseconds',
    '#required' => TRUE,
    '#dependency' => array(
      'edit-options-nodejs' => array(
        0,
      ),
    ),
  );
  $form['incremental'] = array(
    '#type' => 'checkbox',
    '#title' => t('Incrementally insert new items. Unless your view is using an overridden template, the defaults below should be fine.'),
    '#default_value' => $this->options['incremental'],
  );
  $form['incremental_advanced']['sourceSelector'] = array(
    '#type' => 'textfield',
    '#title' => t('Container selector'),
    '#default_value' => $this->options['incremental_advanced']['sourceSelector'],
    '#description' => t('A jQuery selector expression representing the main view container of your display.'),
    '#dependency' => array(
      'edit-options-incremental' => array(
        1,
      ),
    ),
  );
  $form['incremental_advanced']['emptySelector'] = array(
    '#type' => 'textfield',
    '#title' => t('Empty selector'),
    '#default_value' => $this->options['incremental_advanced']['emptySelector'],
    '#description' => t('A jQuery selector expression representing the main view container in case of empty results.'),
    '#dependency' => array(
      'edit-options-incremental' => array(
        1,
      ),
    ),
  );
  $form['incremental_advanced']['afterSelector'] = array(
    '#type' => 'textfield',
    '#title' => t('Header selector'),
    '#default_value' => $this->options['incremental_advanced']['afterSelector'],
    '#description' => t('A jQuery selector expression representing the view header, in case the header is displayed with empty results.'),
    '#dependency' => array(
      'edit-options-incremental' => array(
        1,
      ),
    ),
  );
  $form['incremental_advanced']['targetStructure'] = array(
    '#type' => 'textfield',
    '#title' => t('Target structure'),
    '#default_value' => $this->options['incremental_advanced']['targetStructure'],
    '#description' => t('An HTML fragment describing the view skeleton in case of empty results.'),
    '#dependency' => array(
      'edit-options-incremental' => array(
        1,
      ),
    ),
  );
  $form['incremental_advanced']['firstClass'] = array(
    '#type' => 'textfield',
    '#title' => t('First row class'),
    '#default_value' => $this->options['incremental_advanced']['firstClass'],
    '#description' => t('A class to be added to the first result row.'),
    '#dependency' => array(
      'edit-options-incremental' => array(
        1,
      ),
    ),
  );
  $form['incremental_advanced']['lastClass'] = array(
    '#type' => 'textfield',
    '#title' => t('Last row class'),
    '#default_value' => $this->options['incremental_advanced']['lastClass'],
    '#description' => t('A class to be added to the last result row.'),
    '#dependency' => array(
      'edit-options-incremental' => array(
        1,
      ),
    ),
  );
  $form['incremental_advanced']['oddClass'] = array(
    '#type' => 'textfield',
    '#title' => t('Odd rows class'),
    '#default_value' => $this->options['incremental_advanced']['oddClass'],
    '#description' => t('A class to be added to each odd result row.'),
    '#dependency' => array(
      'edit-options-incremental' => array(
        1,
      ),
    ),
  );
  $form['incremental_advanced']['evenClass'] = array(
    '#type' => 'textfield',
    '#title' => t('Even rows class'),
    '#default_value' => $this->options['incremental_advanced']['evenClass'],
    '#description' => t('A class to be added to each even result row.'),
    '#dependency' => array(
      'edit-options-incremental' => array(
        1,
      ),
    ),
  );
  $form['incremental_advanced']['rowClassPrefix'] = array(
    '#type' => 'textfield',
    '#title' => t('Row class prefix'),
    '#default_value' => $this->options['incremental_advanced']['rowClassPrefix'],
    '#description' => t('The prefix of a class to be added to each result row. The row number will be appended to this prefix.'),
    '#dependency' => array(
      'edit-options-incremental' => array(
        1,
      ),
    ),
  );
  $form['ping'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use a ping url'),
    '#default_value' => $this->options['ping'],
    '#description' => t('Use a custom script for faster check of new items. See <code>ping.php.example</code> in <code>views_autorefresh</code> folder for reference.'),
  );
  $form['ping_base_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Path to the ping script'),
    '#default_value' => $this->options['ping_base_path'],
    '#description' => t('This path is relative to the Drupal root.'),
    '#dependency' => array(
      'edit-options-ping' => array(
        1,
      ),
    ),
  );
  $form['ping_arguments'] = array(
    '#type' => 'textarea',
    '#title' => t('Ping arguments'),
    '#default_value' => $this->options['ping_arguments'],
    '#description' => t('A PHP script that generates arguments that will be sent on the ping URL as query parameters. Do not surround with <code>&lt;?php&gt;</code> tag.'),
    '#dependency' => array(
      'edit-options-ping' => array(
        1,
      ),
    ),
  );
}