diff --git a/plugins/views_plugin_row_rss_fields.inc b/plugins/views_plugin_row_rss_fields.inc index 5decfb4..3cf2afc 100644 --- a/plugins/views_plugin_row_rss_fields.inc +++ b/plugins/views_plugin_row_rss_fields.inc @@ -10,12 +10,12 @@ class views_plugin_row_rss_fields extends views_plugin_row { function option_definition() { $options = parent::option_definition(); - $options['title_field'] = array('default' => 'none'); - $options['link_field'] = array('default' => 'none'); - $options['description_field'] = array('default' => 'none'); - $options['creator_field'] = array('default' => 'none'); - $options['date_field'] = array('default' => 'none'); - $options['guid_field_options']['guid_field'] = array('default' => 'none'); + $options['title_field'] = array('default' => ''); + $options['link_field'] = array('default' => ''); + $options['description_field'] = array('default' => ''); + $options['creator_field'] = array('default' => ''); + $options['date_field'] = array('default' => ''); + $options['guid_field_options']['guid_field'] = array('default' => ''); $options['guid_field_options']['guid_field_is_permalink'] = array('default' => TRUE, 'bool' => TRUE); return $options; } @@ -23,44 +23,43 @@ class views_plugin_row_rss_fields extends views_plugin_row { function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); - $view_fields = array('none' => t('- None -')); - foreach ($this->display->handler->get_handlers('field') as $field => $handler) { - $view_fields[$field] = $handler->ui_name(); - } + $initial_labels = array('' => t('- None -')); + $view_fields_labels = $this->display->handler->get_field_labels(); + $view_fields_labels = array_merge($initial_labels, $view_fields_labels); $form['title_field'] = array( '#type' => 'select', '#title' => t('Title field'), '#description' => t('The field that is going to be used as the RSS item title for each row.'), - '#options' => $view_fields, + '#options' => $view_fields_labels, '#default_value' => $this->options['title_field'], ); $form['link_field'] = array( '#type' => 'select', '#title' => t('Link field'), '#description' => t('The field that is going to be used as the RSS item link for each row. This must be a drupal relative path.'), - '#options' => $view_fields, + '#options' => $view_fields_labels, '#default_value' => $this->options['link_field'], ); $form['description_field'] = array( '#type' => 'select', '#title' => t('Description field'), '#description' => t('The field that is going to be used as the RSS item description for each row.'), - '#options' => $view_fields, + '#options' => $view_fields_labels, '#default_value' => $this->options['description_field'], ); $form['creator_field'] = array( '#type' => 'select', '#title' => t('Creator field'), '#description' => t('The field that is going to be used as the RSS item creator for each row.'), - '#options' => $view_fields, + '#options' => $view_fields_labels, '#default_value' => $this->options['creator_field'], ); $form['date_field'] = array( '#type' => 'select', '#title' => t('Publication date field'), '#description' => t('The field that is going to be used as the RSS item pubDate for each row. It needs to be in RFC 2822 format.'), - '#options' => $view_fields, + '#options' => $view_fields_labels, '#default_value' => $this->options['date_field'], ); $form['guid_field_options'] = array( @@ -73,7 +72,7 @@ class views_plugin_row_rss_fields extends views_plugin_row { '#type' => 'select', '#title' => t('GUID field'), '#description' => t('The globally unique identifier of the RSS item.'), - '#options' => $view_fields, + '#options' => $view_fields_labels, '#default_value' => $this->options['guid_field_options']['guid_field'], ); $form['guid_field_options']['guid_field_is_permalink'] = array( @@ -88,13 +87,13 @@ class views_plugin_row_rss_fields extends views_plugin_row { $errors = parent::validate(); $required_options = array('title_field', 'link_field', 'description_field', 'creator_field', 'date_field'); foreach ($required_options as $required_option) { - if (empty($this->options[$required_option]) || $this->options[$required_option] == 'none') { + if (empty($this->options[$required_option])) { $errors[] = t('Row style plugin requires specifying which views fields to use for RSS item.'); break; } } // Once more for guid. - if (empty($this->options['guid_field_options']['guid_field']) || $this->options['guid_field_options']['guid_field'] == 'none') { + if (empty($this->options['guid_field_options']['guid_field'])) { $errors[] = t('Row style plugin requires specifying which views fields to use for RSS item.'); } return $errors;