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
- Provide the proposed resolution
- Review/test (preferable in combination with #3324724: Rewrite plugin doesn't replace "parent" values)
- Merge
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
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
Comment #3
megachrizComment #4
megachrizComment #5
megachrizTested this for the Rewrite plugin in combination with #3324724: Rewrite plugin doesn't replace "parent" values. Both together it looks to work well. Merged.