function views_autorefresh_handler_area_autorefresh::options_form in Views Auto-Refresh 7
Same name and namespace in other branches
- 7.2 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 47
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('Use a secondary view display to incrementally insert new items only'),
'#default_value' => $this->options['incremental'],
);
$options = array();
if ($this->view->display) {
foreach ($this->view->display as $display) {
if ($display->display_plugin == 'page') {
// @TODO: check secondary display arguments.
$options[$display->id] = $display->display_title;
}
}
}
$incremental_advanced = $this->options['incremental_advanced'];
$form['display'] = array(
'#type' => 'select',
'#title' => t('Secondary display'),
'#default_value' => $this->options['display'],
'#description' => t('Only displays of type page are eligible. Additionally the display must have a timestamp argument of the <em>(with operator)</em> variant. For example <em>Node: Post date (with operator)</em>.'),
'#options' => $options,
'#dependency' => array(
'edit-options-incremental' => array(
1,
),
),
);
$form['incremental_advanced'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#dependency' => array(
'edit-options-incremental' => array(
1,
),
),
'#description' => t('Advanced settings for incremental display. Unless your view is using an overridden template, the defaults below should be fine.'),
);
$form['incremental_advanced']['sourceSelector'] = array(
'#type' => 'textfield',
'#title' => t('Source selector'),
'#default_value' => $incremental_advanced['sourceSelector'],
'#description' => t('A jQuery selector expression representing the main view container of your secondary display.'),
);
$form['incremental_advanced']['targetSelector'] = array(
'#type' => 'textfield',
'#title' => t('Target selector'),
'#default_value' => $incremental_advanced['targetSelector'],
'#description' => t('A jQuery selector expression representing the main view container of your primary display.'),
);
$form['incremental_advanced']['emptySelector'] = array(
'#type' => 'textfield',
'#title' => t('Empty selector'),
'#default_value' => $incremental_advanced['emptySelector'],
'#description' => t('A jQuery selector expression representing the main view container in case of empty results.'),
);
$form['incremental_advanced']['afterSelector'] = array(
'#type' => 'textfield',
'#title' => t('Header selector'),
'#default_value' => $incremental_advanced['afterSelector'],
'#description' => t('A jQuery selector expression representing the view header, in case the header is displayed with empty results.'),
);
$form['incremental_advanced']['targetStructure'] = array(
'#type' => 'textfield',
'#title' => t('Target structure'),
'#default_value' => $incremental_advanced['targetStructure'],
'#description' => t('An HTML fragment describing the view skeleton in case of empty results.'),
);
$form['incremental_advanced']['firstClass'] = array(
'#type' => 'textfield',
'#title' => t('First row class'),
'#default_value' => $incremental_advanced['firstClass'],
'#description' => t('A class to be added to the first result row.'),
);
$form['incremental_advanced']['lastClass'] = array(
'#type' => 'textfield',
'#title' => t('Last row class'),
'#default_value' => $incremental_advanced['lastClass'],
'#description' => t('A class to be added to the last result row.'),
);
$form['incremental_advanced']['oddClass'] = array(
'#type' => 'textfield',
'#title' => t('Odd rows class'),
'#default_value' => $incremental_advanced['oddClass'],
'#description' => t('A class to be added to each odd result row.'),
);
$form['incremental_advanced']['evenClass'] = array(
'#type' => 'textfield',
'#title' => t('Even rows class'),
'#default_value' => $incremental_advanced['evenClass'],
'#description' => t('A class to be added to each even result row.'),
);
$form['incremental_advanced']['rowClassPrefix'] = array(
'#type' => 'textfield',
'#title' => t('Row class prefix'),
'#default_value' => $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.'),
);
$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>views_autorefresh_ping.default.php</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><?php></code> tag.'),
'#dependency' => array(
'edit-options-ping' => array(
1,
),
),
);
$form['trigger_onload'] = array(
'#type' => 'checkbox',
'#title' => t('Trigger Refresh on Load'),
'#default_value' => $this->options['trigger_onload'],
);
}