Problem/Motivation

I want to set revision log message to contain the time of the import. Rewrite plugin shows the list of patterns that is support , including "[parent:imported]", but none of those "parent" patterns are replaced. Leaving the "[parent:*]" patterns in the text.

Steps to reproduce

Proposed resolution

Move all parent properties to a new "Supported replacement patterns" heading on the form , with additional note to make it clear that the values will be replaced only if the property was used in a mapping.

Remaining tasks

Agree on proposed resolution
patch
review
commit

User interface changes

Split available tokens into two groups, available and supported.

API changes

None.

Data model changes

None.

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

RoSk0 created an issue. See original summary.

rosk0’s picture

Based on #3332114: Missing parent properties on a feeds item - parent properties listed as Available replacement patterns on the plugin configuration form are actually only available if was explicitly used in the feed type mapping.

This is very misleading.

I propose to move all parent properties to a new "Supported replacement patterns" heading on the form , with additional note to make it clear that the values will be replaced only if the property was used in a mapping.

megachriz’s picture

It is a good idea to document that currently certain sources cannot be used unless they are used in mapping.

The quickest way to add that is to display that information for every Tamper plugin. This is because Feeds Tamper doesn't know which Tamper plugins act on the source list. Feeds Tamper just passes that information for every plugin.

An other solution would be that Tamper can tell Feeds Tamper that it actively uses the source list. Then Feeds Tamper would provide the information only for these plugins.

One step further would be that Tamper tells Feeds Tamper which sources are used. Feeds Tamper could then use that information to fetch the necessary data. In this case no documentation is needed as then the "parent" values will automatically become available.

Another step further would be that Feeds checks if the data that Tamper requests is provided by a FeedsSource plugin. And then automatically load it. In this case no changes in Tamper and Feeds Tamper are necessary for this issue.

kopeboy’s picture

megachriz’s picture

Assigned: Unassigned » megachriz

I plan to work on this in the next few weeks.

megachriz’s picture

Assigned: megachriz » Unassigned
Status: Active » Needs review

I've provided a solution for this issue! Even though the tests are not passing yet, this is now ready for review and testing.

It works as follows:

  1. Tamper plugins that work with a tamperable item (like the Rewrite plugin), provide a list of source fields they use on the item.
  2. Feeds Tamper checks if any of these source fields are provided by FeedsSource plugins. This is the case for all "Feed entity" sources, that are listed for the Rewrite plugin as "[parent:*]" tokens.
  3. Feeds Tamper loads the data for FeedsSource source fields.

Be sure to test it in combination with #3541447: Make Tamper plugins tell which properties they use of a tamperable item. That issue provides changes for the Tamper module, so that plugins can provide a list of source fields that they use. Changes don't apply on the latest Tamper release, so you should apply them on the dev release. The Tamper dev release also contains other improvements for the Rewrite plugin.

megachriz’s picture

Status: Needs review » Fixed

I merged the code!

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 3ff64e29 on 8.x-2.x
    Issue #3324724 by megachriz: Lazy load FeedsSource values when used by a...

Status: Fixed » Closed (fixed)

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