Install

Works with Drupal: ^8 || ^9 || ^10

Using dev releases is not recommended, except for testing.

Using Composer to manage Drupal site dependencies

Alternative installation files

Download feeds_tamper-8.x-2.x-dev.tar.gztar.gz 29.24 KB
MD5: 3e8ebf5962875418e9463cda49a4832e
SHA-1: 4a01f114b5fa00e8f9687cccbf0866f4d3e41f4e
SHA-256: 6da514e48fe04c3b1265e08247e6f316bd707f6a451689afbde60787ea09b497
Download feeds_tamper-8.x-2.x-dev.zipzip 54.3 KB
MD5: ee70fd74a4f4b0ced34a2725625188d2
SHA-1: 326b1954f847ef0bfc36a5577ac38eb4be90b86a
SHA-256: ca28d14aee552ac055d6f7a4ef897aa8357ccb132633edeaedaa8f5fa53976bb

Release notes

Work in progress of the D8 version of Feeds Tamper. Feeds Tamper now depends on the Tamper module.

There is no UI yet, but the module is minimally usable in the following way:

// Load a feed type.
/** @var \Drupal\feeds\FeedTypeInterface */
$feed_type = \Drupal\feeds\Entity\FeedType::load('article_importer');

// Get Tamper functionality for this feed type.
/** @var \Drupal\feeds_tamper\FeedTypeTamperMetaInterface */
$tamper_meta = \Drupal::service('feeds_tamper.feed_type_tamper_manager')->getTamperMeta($feed_type);

// Example: add a Tamper plugin of type 'explode' to source field 'gamma'.
/** @var \Drupal\tamper\TamperInterface */
$tamper = $tamper_meta->addTamper([
  'plugin' => 'explode',
  'source' => 'gamma',
  'separator' => ',',
  'description' => 'Explode with comma character',
]);
// And save the feed type to make the addition permanent.
$feed_type->save();

// Example: get a single Tamper instance.
/** @var \Drupal\tamper\TamperInterface */
$tamper = $tamper_meta->getTamper($uuid);

// Example: get all tampers for a feed type.
/** @var \Drupal\feeds_tamper\TamperPluginCollection|\Drupal\tamper\TamperInterface[] */
$tampers = $tamper_meta->getTampers();

// Example: get all tampers for a feed type keyed by source.
/** @var \Drupal\tamper\TamperInterface[][] */
$tampers_by_source = $tamper_meta->getTampersGroupedBySource();

// Example: remove a tamper instance. Changes are immediately permanent (feed 
// type is saved in the process).
$tamper_meta->removeTamper($tamper);

One way of executing the code examples from above is by using the 'Execute PHP' form from the Devel module.

Available Tamper plugins
The available Tamper plugins can be found in the Tamper module in the folder tamper/src/Plugin/Tamper.
You can also get a list of available tamper plugins this way:

// Get tamper manager.
/** @var \Drupal\tamper\TamperManagerInterface */
$tamper_manager = \Drupal::service('plugin.manager.tamper');

// Get definitions. Definitions will be an array of available plugins where the
// key will be the plugin ID and value the plugin's metadata.
/** @var array */
$definitions = $tamper_manager->getDefinitions();
Created by: MegaChriz
Created on: 18 Jan 2018 at 13:55 UTC
Last updated: 8 Dec 2022 at 13:27 UTC

Other releases