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.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | Feed.patch | 577 bytes | hedrickbt |
Comments
Comment #2
hedrickbt commentedComment #3
hedrickbt commentedComment #4
robert castelo commentedConfirming 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
Comment #5
twistor commentedWhat 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.
Comment #6
hedrickbt commented@twistor,
Here's the module I have developed, called Feeds Auth OpenAM, which has the issue
https://www.drupal.org/node/2728825
Comment #7
hedrickbt commentedComment #9
twistor commentedNice. The map item didn't exist when I created the feeds_serialized item.
Comment #10
hedrickbt commentedThanks for fixing this @twistor!