Problem/Motivation

In order to fix #3324724: Rewrite plugin doesn't replace "parent" values it is necessary that Tamper plugins that make use of a tamperable item, report which fields it uses on such an item. Feeds Tamper can then use that information to lazy load data for some of these fields. To be precise: Feeds Tamper wants to use it to lazy load data from FeedsSource plugins.

Proposed resolution

Add a new interface called ItemUsageInterface with one method called getUsedSourceProperties(). (I have plans to add more methods to it in a follow-up issue, but for the sake of this issue, just that method only.)

The reason to create a new interface, instead of adding the method to the existing TamperInterface, is so that other modules (like Feeds Tamper) can check if the item implements the new interface and then know that they can call getUsedSourceProperties() on it. It's also good for backwards compatibility: classes that implement TamperInterface, but do not extend TamperBase, will not break this way.

All Tamper plugins that make use of the tamperable item, implement that method. These are:

  • absolute_url
  • copy
  • rewrite
  • twig

However, TamperBase will implement the interface. That's because in a follow-up issue I'd like to add more methods that make sense to have for all Tamper plugins.

Remaining tasks

User interface changes

None.

API changes

  • All Tamper plugins from the Tamper module will implement the interface \Drupal\tamper\ItemUsageInterface.
  • All Tamper plugins from the Tamper module will get a new method called getUsedSourceProperties().

Data model changes

None.

Issue fork tamper-3541447

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

megachriz created an issue. See original summary.

megachriz’s picture

Assigned: megachriz » Unassigned
Status: Active » Needs review
megachriz’s picture

megachriz’s picture

Status: Needs review » Fixed

Tested this for the Rewrite plugin in combination with #3324724: Rewrite plugin doesn't replace "parent" values. Both together it looks to work well. Merged.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

  • megachriz committed 96168176 on 8.x-1.x
    Issue #3541447 by megachriz: Make Tamper plugins tell which properties...

Status: Fixed » Closed (fixed)

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