When defining the feed custom config will not save. This is being caused by an issue in the Drupal\feeds\Plugin\Field\FieldType\SerializedItem class.

Currently, the Drupal\aggregator\Entity\Feed class uses

$fields['config'] = BaseFieldDefinition::create('feeds_serialized')

If this is simply changed to
$fields['config'] = BaseFieldDefinition::create('map')

This resolves the issue.

We have tested the Download fetcher with rss, opml, and a new JSON parser and are not seeing any issues.

The error happens in Drupal\Core\TypedData\Validation\RecursiveContextualValidator
protected function validateNode(TypedDataInterface $data, $constraints = NULL, $is_root_call = FALSE) {
...
// If the data is a list or complex data, validate the contained list items
// or properties. However, do not recurse if the data is empty.
if (($data instanceof ListInterface || $data instanceof ComplexDataInterface) && !$data->isEmpty()) {
foreach ($data as $name => $property) {
$this->validateNode($property); #this is where the error happens
}
}

Here's the error:
Recoverable fatal error: Argument 1 passed to Drupal\Core\TypedData\Validation\RecursiveContextualValidator::validateNode() must implement interface Drupal\Core\TypedData\TypedDataInterface, array given, called in /datadg/www/drupal/zckb/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php on line 152 and defined in Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode() (line 125 of /datadg/www/drupal/zckb/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php).

Another option to fix the problem if the SerializedItem class is actually needed is to have the propertyDefinitions() method return an empty array().

This issue prevents modules from being added that extend the Feed form when they use the 'config' field to store the settings.

CommentFileSizeAuthor
#2 Feed.patch577 byteshedrickbt

Comments

hedrickbt created an issue. See original summary.

hedrickbt’s picture

StatusFileSize
new577 bytes
hedrickbt’s picture

Status: Active » Needs review
robert castelo’s picture

Confirming that this is an issue.

I've written a module which adds a parser for BrightTALK content, it fails with the problem described in this issue.

However, if I copy the pareser file to the Feeds module to where the other parser files are located, it then works perfectly.

https://www.drupal.org/project/feeds_brighttalk

twistor’s picture

Component: Feeds Import (feature) » Code
Status: Needs review » Postponed (maintainer needs more info)

This issue prevents modules from being added that extend the Feed form when they use the 'config' field to store the settings.

What exactly are you trying to extend?

@Robert Castelo, I have no problem using your module without coping any files. That sounds like a different problem.

hedrickbt’s picture

@twistor,

Here's the module I have developed, called Feeds Auth OpenAM, which has the issue

https://www.drupal.org/node/2728825

hedrickbt’s picture

Status: Postponed (maintainer needs more info) » Needs review

  • twistor committed 5e4bf5a on 8.x-3.x authored by hedrickbt
    Issue #2728621 by hedrickbt, twistor: Adding modules that hook into the...
twistor’s picture

Status: Needs review » Fixed

Nice. The map item didn't exist when I created the feeds_serialized item.

hedrickbt’s picture

Thanks for fixing this @twistor!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.