You are here

protected function RssFields::defineOptions in Views RSS 8.2

Same name in this branch
  1. 8.2 src/Plugin/views/style/RssFields.php \Drupal\views_rss\Plugin\views\style\RssFields::defineOptions()
  2. 8.2 src/Plugin/views/row/RssFields.php \Drupal\views_rss\Plugin\views\row\RssFields::defineOptions()
Same name and namespace in other branches
  1. 8.3 src/Plugin/views/style/RssFields.php \Drupal\views_rss\Plugin\views\style\RssFields::defineOptions()

Information about options for all kinds of purposes will be held here.


'option_name' => array(
 - 'default' => default value,
 - 'contains' => (optional) array of items this contains, with its own
     defaults, etc. If contains is set, the default will be ignored and
     assumed to be array().
 ),

Return value

array Returns the options of this handler/plugin.

Overrides StylePluginBase::defineOptions

File

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

Class

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

Namespace

Drupal\views_rss\Plugin\views\style

Code

protected function defineOptions() {
  $options = parent::defineOptions();

  // Namespace defaults.
  $namespaces = views_rss_get('namespaces');
  if (count($namespaces)) {
    foreach ($namespaces as $module => $module_namespaces) {
      foreach (array_keys($module_namespaces) as $namespace) {
        $options['namespaces']['contains'][$module]['contains'][$namespace] = [
          'default' => NULL,
        ];
      }
    }
  }
  if (function_exists('rdf_get_namespaces')) {
    $options['namespaces']['contains']['add_rdf_namespaces'] = [
      'default' => FALSE,
    ];
  }

  // Channel element defaults.
  $channel_elements = views_rss_get('channel_elements');
  if (count($channel_elements)) {
    foreach ($channel_elements as $module => $module_channel_elements) {
      foreach (array_keys($module_channel_elements) as $element) {
        list($namespace, $element_name) = views_rss_extract_element_names($element, 'core');
        $options['channel']['contains'][$namespace]['contains'][$module]['contains'][$element_name] = [
          'default' => NULL,
        ];
      }
    }
  }

  // Other feed settings defaults.
  $options['feed_settings']['contains']['absolute_paths'] = [
    'default' => 1,
  ];
  $options['feed_settings']['contains']['feed_in_links'] = [
    'default' => 0,
  ];
  return $options;
}