1

I have a simple RSS feed I am importing via core Aggregator module in Drupal 8.5. One specific field in the Item can't be accessed by Views, and it's critical for display. I'm relying on hacky approach right now, but would love to do it right.

What's the process in getting a specific ATOM Rss field registered so that it appears in Views UI? Can't find any info on building custom Aggregator plugins for fetcher/parser/processors.

Anyone have other thoughts on how to approach?

Thanks in advance for all insight.

PTG

1

Aggregator offer the possibility to add custom fetch/parser/process to update/override/remove actions on the global process.

For example I managed to make aggregator deal with enclose url image. Their are several ways to do it with Drupal 8. I used a very simple one : Annotation.

/**
 * Defines a default parser implementation.
 *
 * Parses RSS, Atom and RDF feeds.
 *
 * @AggregatorParser(
 *   id = "xxxxx_aggregator",
 *   title = @Translation("XXXX parser"),
 *   description = @Translation("Custom parser for RSS enclosure tag.")
 * )
 */
class CustomParser extends DefaultParser {

  /**
   * Override default parser to add the enclosure attribute to feed item
   * {@inheritdoc}
   */
  public function parse(FeedInterface $feed) {

    parent::parse($feed);
    // your code...
  }

}

In this given example, using @AggregatorParser, I allow Aggregator to detect and use another PARSER, my custom, which is extending the aggregator's default.

Do not forget to add it in the correct needed path. Here its : namespace Drupal\xxxxx_aggregator\Plugin\aggregator\parser;

You will be able to see and enable it on the aggregator feed admin page.

For deeper informations you can analyse the aggregation process throught the module's files, this contrib module use plugin management and hooks api. AggregatorPluginManager.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.