summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaciej Zgadzaj2011-11-18 13:12:52 (GMT)
committer Maciej Zgadzaj2011-11-18 13:12:52 (GMT)
commitb8146655300f00d5761cf728a3107ab7f0bcaa4f (patch)
treee981d703a4637d82bb38f7f939343681ea4bbdba
parent16ec9289975c1a7066e099f997f643a71e56825b (diff)
Issue #1321208: added XML namespaces support
-rw-r--r--views/views_plugin_style_rss_fields.inc33
1 files changed, 32 insertions, 1 deletions
diff --git a/views/views_plugin_style_rss_fields.inc b/views/views_plugin_style_rss_fields.inc
index 717a8b9..3bfc251 100644
--- a/views/views_plugin_style_rss_fields.inc
+++ b/views/views_plugin_style_rss_fields.inc
@@ -94,12 +94,43 @@ class views_plugin_style_rss_fields extends views_plugin_style {
'#collapsed' => TRUE,
'#weight' => -5,
);
+ // Legacy setting: previously Feed Description fieldset name was different.
+ // Should probably rather go to hook_update_N()...
+ if (isset($this->options['description']['feed_description']) && $this->options['description']['feed_description']) {
+ $this->options['feed_settings']['feed_description'] = $this->options['description']['feed_description'];
+ }
$form['feed_settings']['feed_description'] = array(
'#title' => t('Feed description'),
'#type' => 'textarea',
- '#default_value' => $this->options['feed_settings']['feed_description'],
+ '#default_value' => isset($this->options['feed_settings']['feed_description']) ? $this->options['feed_settings']['feed_description'] : '',
'#description' => t('Description for this feed. If left blank, the default site mission will be used.'),
);
+ // Namespaces
+ $form['feed_settings']['namespaces'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('XML namespace definitions'),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+ // Loop through all available fields (both predefined by this module
+ // as well as those coming from hook_views_rss_item_fields_alter()
+ // implementations by other modules) and check if there are any other
+ // namespaces that should be added to configuration form.
+ $predefined_namespaces = $this->xml_namespaces();
+ foreach (array_keys($this->xml_fields()) as $field_name) {
+ if (strstr($field_name, ':')) {
+ list($namespace, $field) = explode(':', $field_name);
+ // Namespaces predefined by this module should be excluded.
+ if (!in_array($namespace, array_keys($predefined_namespaces))) {
+ $form['feed_settings']['namespaces'][$namespace] = array(
+ '#title' => t('URI reference for "%namespace" namespace', array('%namespace' => $namespace)),
+ '#type' => 'textfield',
+ '#default_value' => isset($this->options['feed_settings']['namespaces'][$namespace]) ? $this->options['feed_settings']['namespaces'][$namespace] : NULL,
+ '#description' => t("Example: <em>http://base.google.com/ns/1.0</em>"),
+ );
+ }
+ }
+ }
$form['feed_settings']['feed_in_links'] = array(
'#type' => 'checkbox',
'#default_value' => !empty($this->options['feed_settings']['feed_in_links']),