You are here

public function SyndicationParser::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/SyndicationParser.php, line 98

Class

SyndicationParser
Defines an RSS and Atom feed parser.

Namespace

Drupal\feeds\Feeds\Parser

Code

public function getMappingSources() {
  return [
    'feed_title' => [
      'label' => $this
        ->t('Feed title'),
      'description' => $this
        ->t('Title of the feed.'),
    ],
    'feed_description' => [
      'label' => $this
        ->t('Feed description'),
      'description' => $this
        ->t('Description of the feed.'),
    ],
    'feed_image_uri' => [
      'label' => $this
        ->t('Feed image'),
      'description' => $this
        ->t('The URL of the feed image.'),
    ],
    'feed_url' => [
      'label' => $this
        ->t('Feed URL (link)'),
      'description' => $this
        ->t('URL of the feed.'),
    ],
    'title' => [
      'label' => $this
        ->t('Title'),
      'description' => $this
        ->t('Title of the feed item.'),
      'suggestions' => [
        'targets' => [
          'subject',
          'title',
          'label',
          'name',
        ],
        'types' => [
          'field_item:text' => [],
        ],
      ],
    ],
    'content' => [
      'label' => $this
        ->t('Content'),
      'description' => $this
        ->t('Content of the feed item.'),
      'suggested' => [
        'body',
      ],
      'suggestions' => [
        'targets' => [
          'body',
        ],
        'types' => [
          'field_item:text_with_summary' => [],
        ],
      ],
    ],
    'description' => [
      'label' => $this
        ->t('Description'),
      'description' => $this
        ->t('Description of the feed item.'),
      'suggested' => [
        'body',
      ],
      'suggestions' => [
        'targets' => [
          'body',
        ],
        'types' => [
          'field_item:text_with_summary' => [],
        ],
      ],
    ],
    'author_name' => [
      'label' => $this
        ->t('Author name'),
      'description' => $this
        ->t("Name of the feed item's author."),
      'suggestions' => [
        'types' => [
          'entity_reference_field' => [
            'target_type' => 'user',
          ],
        ],
      ],
    ],
    'author_email' => [
      'label' => $this
        ->t('Author email'),
      'description' => $this
        ->t("Name of the feed item's email address."),
    ],
    'timestamp' => [
      'label' => $this
        ->t('Published date'),
      'description' => $this
        ->t('Published date as UNIX time GMT of the feed item.'),
      'suggestions' => [
        'targets' => [
          'created',
        ],
      ],
    ],
    'updated' => [
      'label' => $this
        ->t('Updated date'),
      'description' => $this
        ->t('Updated date as UNIX time GMT of the feed item.'),
      'suggestions' => [
        'targets' => [
          'changed',
        ],
      ],
    ],
    'url' => [
      'label' => $this
        ->t('Item URL (link)'),
      'description' => $this
        ->t('URL of the feed item.'),
      'suggestions' => [
        'targets' => [
          'url',
        ],
      ],
    ],
    'guid' => [
      'label' => $this
        ->t('Item GUID'),
      'description' => $this
        ->t('Global Unique Identifier of the feed item.'),
      'suggestions' => [
        'targets' => [
          'guid',
        ],
      ],
    ],
    'tags' => [
      'label' => $this
        ->t('Categories'),
      'description' => $this
        ->t('An array of categories that have been assigned to the feed item.'),
      'suggestions' => [
        'targets' => [
          'field_tags',
        ],
        'types' => [
          'field_item:taxonomy_term_reference' => [],
        ],
      ],
    ],
    'georss_lat' => [
      'label' => $this
        ->t('Item latitude'),
      'description' => $this
        ->t('The feed item latitude.'),
    ],
    'georss_lon' => [
      'label' => $this
        ->t('Item longitude'),
      'description' => $this
        ->t('The feed item longitude.'),
    ],
    'enclosures' => [
      'label' => $this
        ->t('Enclosures'),
      'description' => $this
        ->t('A list of enclosures attached to the feed item.'),
      'suggestions' => [
        'types' => [
          'field_item:file' => [],
        ],
      ],
    ],
  ];
}