You are here

protected function RssFields::getNamespaces in Views RSS 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/views/style/RssFields.php \Drupal\views_rss\Plugin\views\style\RssFields::getNamespaces()

Function getNamespaces.

1 call to RssFields::getNamespaces()
RssFields::render in src/Plugin/views/style/RssFields.php
Render the display in this style.

File

src/Plugin/views/style/RssFields.php, line 409

Class

RssFields
Default style plugin to render an RSS feed from fields.

Namespace

Drupal\views_rss\Plugin\views\style

Code

protected function getNamespaces() {
  $namespaces = array();
  foreach (views_rss_get('namespaces') as $module => $module_namespaces) {
    foreach ($module_namespaces as $namespace => $definition) {

      // Check if definition provided through modules hooks
      // should be overwritten by module configuration.
      if (isset($this->options['namespaces'][$module][$namespace]) && !empty($this->options['namespaces'][$module][$namespace])) {
        $definition['uri'] = $this->options['namespaces'][$module][$namespace];
      }

      // Add namespace to feed array.
      if (!empty($definition['uri'])) {

        // Namespaces with prefix, for example xml:base="" or xmlns:dc="".
        if (!empty($definition['prefix'])) {
          $namespace_key = $definition['prefix'] . ':' . $namespace;
          $namespaces[$namespace_key] = $definition['uri'];
        }
        else {
          $namespaces[$namespace] = $definition['uri'];
        }
      }
    }
  }
  return $namespaces;
}