Allow parsers and event subscribers to mark an item as invalid

Created on 20 June 2019, almost 6 years ago
Updated 19 April 2025, about 2 months ago

Problem/Motivation

🐛 Catch TamperException to prevent import from crashing Needs work tries to prevent an import from crashing if an unapplicable tamper plugin gets applied to a source. A tamper plugin is for example not applicable to a source if the tamper plugin expects the source to be in certain format when the source isn't. For example, the tamper plugin "implode" expects the source to be an array and throws an exception if it doesn't.

The patch from the issue noted above now catches an exception and records an error message for it. The problem is that the import of the item goes through, only just without the tampers applied. This can possible lead to unintended values being imported.

Removing the item from the parser result is also not an option, because then it might be removed from the site if the feed type is configured to delete previously imported items.

Proposed resolution

A possible solution is to be able to mark an item as invalid, by adding new methods to \Drupal\feeds\Feeds\Item\ItemInterface.

Then, during processing, Feeds needs to detect that the item is marked invalid. And if so, don't import it. And report which item is invalid.

Remaining tasks

  • Implement a solution.
  • Add test coverage.
  • Review.
  • Commit.

User interface changes

None.

API changes

\Drupal\feeds\Feeds\Item\ItemInterface gets new methods.

Data model changes

None.

Release notes snippet

New methods are added to \Drupal\feeds\Feeds\Item\ItemInterface: items can now be marked as invalid.

Feature request
Status

Needs work

Version

3.0

Component

Code

Created by

🇳🇱Netherlands megachriz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024