Install
Works with Drupal: ^8.8 || ^9 || ^10 || ^11Using Composer to manage Drupal site dependencies
Alternative installation files
Release notes
Major changes for Keyword Filter and Encode; new plugins: Entity Finder and Absolute Url; empty value handling
Compared to previous releases, this release has larger changes:
- There are changes in behavior for plugins Keyword Filter and Encode.
- The last two remaining plugins from the D7 version have been ported: Entity Finder and Absolute URL.
- Most Tamper plugins were changed to handle empty values better.
Major changes to the Keyword Filter and the Encode plugin
For two Tamper plugins there have been major changes in order to fix existing bugs in it. The behavior of these plugins changed a bit, so it is good to check if these plugins still work as intended for you.
Keyword Filter
- When an item doesn't match the configured requirement, a SkipTamperItemException gets thrown. Previously, an empty string was returned. This is a behavior change, but it makes it consistent with the behavior of the Required plugin + consistent with how the plugin behaved in the D7 version.
-
Configuration keys changed:
- Settings 'regex' and 'function' are removed, these things are now determined on runtime instead of after submitting the configuration form.
- The settings 'words' and 'word_list' are replaced by 'words_list'. The setting 'words' is deprecated, but for now kept for backwards compatibility, but 'word_list' is removed.
Encode plugin
- Not all modes could handle multiple values. A fix is made so that multiple values are iterated over in case that mode only supports a string as input.
- The 'Json Decode' mode now returns an array where it previously returned an object. Note: this mode can return a string too, depending on the input.
- A new option for encoding or decoding YAML is added.
New plugins
-
Entity Finder
Allows you to lookup the ID of an existing content entity by searching for the source value on a specific field. So if the source value is for example "Lorem ipsum" and you choose to search on node title, this plugin will return the ID of a node whose title is "Lorem ipsum".
Note: there are plans to expand this plugin, allowing it to return the value of a field on the entity, rather than just only the entity ID. See #3509334: Entity Finder: add return field option. -
Absolute URL
Replaces relative urls in HTML with absolute urls. Input must be HTML code and an other source must contain the base url.
With these two plugins added, all Tamper plugins from the D7 version are ported! So now we can move on to the beta stage!
Empty value handling
Most Tamper plugins have been changed so they can handle empty data better. Previously, these plugins would throw an exception if they received NULL or an empty string as input. How each plugin responds to an empty value differs per plugin. Most plugins will return the data as is, but a few others would convert it to a value that makes sense for that plugin. For example, the Math plugin will by default treat an empty value as a zero (as it already did before). But you can configure the Math plugin also to return the data as is when the data is empty.
Contributors (15)
megachriz, jamesdixon, zabej, ericgsmith, jhodgdon, liquidcms, vijay.mayilsamy, tbenice, meecect, danharper, davidburns, lammensj, jurgenhaas, kopeboy, ptmkenny
Changelog
Issues: 13 issues resolved.
Changes since 8.x-1.0-alpha5:
Bug
- #3391096 by lammensj, megachriz, ericgsmith, jurgenhaas, kopeboy: Encode plugin: make every mode handle multiples.
- #3497450 by megachriz: Keyword Filter should report that multivalued data remains multivalued.
- #3151524 by megachriz: Make Keyword Filter to skip an item instead of emptying the value.
- #3184186 by megachriz: Keyword filter: removed settings 'regex' and 'function', determine the function to use when applying the Tamper plugin.
Feature
- #2976175 by megachriz, jamesdixon, zabej, ericgsmith, jhodgdon, liquidcms, vijay.mayilsamy, tbenice, meecect, danharper, davidburns: Ported Entity Finder plugin.
- #2976171 by jamesdixon, megachriz, ericgsmith: Ported Absolute URL Plugin.
- #3332785 by megachriz, ptmkenny, ericgsmith: Improved handling of empty data.
- #3358226 by megachriz, jurgenhaas: Refactored Keyword Filter plugin by deprecating and remove some settings and by determining the regex to use at runtime.
- #3184133 by megachriz: Fixed mb_stripos() error for the Keyword Filter plugin on older PHP versions by making the 'words' field required.
- #3480140 by jurgenhaas: Encode plugin: added support for Yaml.