You are here

protected function PodcastViewsMappingsTrait::buildElementFromOptions in Podcast (using Views) 8

Builds the channel element from the options.

Parameters

string $key: The name of the key.

int $row_index: The index of the row to get the fields from.

string[] $options_parents: The parents to extract the field name from the config options.

Return value

array Key value array for the property.

4 calls to PodcastViewsMappingsTrait::buildElementFromOptions()
PodcastViewsMappingsTrait::buildElementForLink in src/PodcastViewsMappingsTrait.php
Same as buildElementFromOptions but generates full URLs.
Rss::getPodcastElements in src/Plugin/views/style/Rss.php
Return an array of additional XHTML elements to add to the podcast channel.
Rss::processCategories in src/Plugin/views/style/Rss.php
Processes categories to output the format expected by iTunes.
RssFields::render in src/Plugin/views/row/RssFields.php
Render a row object. This usually passes through to a theme template of some form, but not always.

File

src/PodcastViewsMappingsTrait.php, line 26

Class

PodcastViewsMappingsTrait
Trait that contains common mapping tasks for channel and item level mappings.

Namespace

Drupal\podcast

Code

protected function buildElementFromOptions($key, $row_index = 0, array $options_parents = NULL) {
  if (empty($options_parents)) {
    $options_parents = [
      sprintf('%s_field', $key),
    ];
  }
  $field_name = NestedArray::getValue($this->options, $options_parents);
  if (empty($field_name)) {
    return [];
  }
  $markup = $this
    ->getField($row_index, $field_name);
  return $markup ? [
    'key' => $key,
    'value' => $markup,
  ] : [];
}