function views_plugin_style_rss_fields::options_form in Views RSS 7
Same name and namespace in other branches
- 6 views/views_plugin_style_rss_fields.inc \views_plugin_style_rss_fields::options_form()
Provide a form for setting options.
_state
Parameters
array $form:
Overrides views_plugin_style::options_form
File
- views/
views_plugin_style_rss_fields.inc, line 77
Class
- views_plugin_style_rss_fields
- Extend the view_plugin_style class to provide an RSS view style.
Code
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$handlers = $this->display->handler
->get_handlers('field');
if (empty($handlers)) {
$form['error_markup'] = array(
'#value' => t('You need at least one field before you can configure your field settings'),
'#prefix' => '<div class="error form-item description">',
'#suffix' => '</div>',
);
}
else {
// Feed Description
$form['description'] = array(
'#type' => 'fieldset',
'#title' => t('Feed Description'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => -5,
);
$form['description']['feed_description'] = array(
'#type' => 'textarea',
'#default_value' => $this->options['description']['feed_description'],
'#description' => t('Description for this feed. If left blank, the default site mission will be used'),
);
// Field Chooser
$field_names = array(
'' => '--',
);
foreach ($handlers as $field => $handler) {
if ($label = $handler
->label()) {
$field_names[$field] = $label;
}
else {
$field_names[$field] = $handler
->ui_name();
}
}
$form['fields'] = array(
'#type' => 'fieldset',
'#title' => 'Field usage',
'#description' => t('Select the fields that relevant data for each element of the feed'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => 0,
);
foreach ($this
->xml_fields() as $k => $option) {
$form['fields'][$k] = array(
'#type' => 'select',
'#title' => $option['title'],
'#description' => isset($option['description']) ? $option['description'] : '',
'#options' => $field_names,
'#default_value' => $this->options['fields'][$k],
);
}
// GeoRSS
$form['georss'] = array(
'#type' => 'fieldset',
'#title' => t('GeoRSS'),
'#description' => t('Select fields that provide the latitude and longitude values'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => 5,
);
$form['georss']['lat'] = array(
'#type' => 'select',
'#title' => t('Latitude'),
'#options' => $field_names,
'#default_value' => $this->options['georss']['lat'],
);
$form['georss']['lon'] = array(
'#type' => 'select',
'#title' => t('Longitude'),
'#options' => $field_names,
'#default_value' => $this->options['georss']['lon'],
);
$form['georss']['featureName'] = array(
'#type' => 'select',
'#title' => t('Feature Name'),
'#options' => $field_names,
'#default_value' => $this->options['georss']['featureName'],
);
}
}