You are here

protected function RssFields::defineOptions in Views RSS 8.3

Same name in this branch
  1. 8.3 src/Plugin/views/style/RssFields.php \Drupal\views_rss\Plugin\views\style\RssFields::defineOptions()
  2. 8.3 src/Plugin/views/row/RssFields.php \Drupal\views_rss\Plugin\views\row\RssFields::defineOptions()
Same name and namespace in other branches
  1. 8.2 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 90
Definition of Drupal\views\Plugin\views\style\Rss.

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'][$module][$namespace] = array(
          'default' => NULL,
        );
      }
    }
  }
  if (function_exists('rdf_get_namespaces')) {
    $options['namespaces']['add_rdf_namespaces'] = array(
      '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'][$namespace][$module][$element_name] = array(
          'default' => NULL,
        );
      }
    }
  }

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