You are here

public function OpmlParser::getMappingSources in Feeds 8.3

Declare the possible mapping sources that this parser produces.

@todo Get rid of the false return here and create a configurable source solution for parsers. @todo Add type data here for automatic mappings. @todo Provide code example.

Return value

array|false An array of mapping sources, or false if the sources can be defined by typing a value in a text field.

Overrides ParserInterface::getMappingSources

File

src/Feeds/Parser/OpmlParser.php, line 101

Class

OpmlParser
Defines an OPML feed parser.

Namespace

Drupal\feeds\Feeds\Parser

Code

public function getMappingSources() {
  return [
    'feed_title' => [
      'label' => $this
        ->t('Feed: Title of the OPML file'),
      'description' => $this
        ->t('Title of the feed.'),
    ],
    'title' => [
      'label' => $this
        ->t('Title'),
      'description' => $this
        ->t('Title of the feed.'),
      'suggestions' => [
        'targets' => [
          'subject',
          'title',
          'label',
          'name',
        ],
        'types' => [
          'field_item:text' => [],
        ],
      ],
    ],
    'xmlurl' => [
      'label' => $this
        ->t('URL'),
      'description' => $this
        ->t('URL of the feed.'),
      'suggestions' => [
        'targets' => [
          'url',
        ],
      ],
    ],
    'categories' => [
      'label' => $this
        ->t('Categories'),
      'description' => $this
        ->t('The categories of the feed.'),
      'suggestions' => [
        'targets' => [
          'field_tags',
        ],
        'types' => [
          'field_item:taxonomy_term_reference' => [],
        ],
      ],
    ],
    'htmlurl' => [
      'label' => $this
        ->t('Site URL'),
      'description' => $this
        ->t('The URL of the site that provides the feed.'),
    ],
  ];
}