You are here

protected function FeedsParaMapperWebTestCase::addTamperPlugins in Feeds Paragraphs 7

Add the needed Tamper plugins (explode) in a loop.

In order to import multiple values to a field, we need to use Tamper.

Parameters

string $source: The source name.

1 call to FeedsParaMapperWebTestCase::addTamperPlugins()
FeedsParaMapperWebTestCase::import in tests/FeedsParaMapperWebTestCase.test
Starts importing.

File

tests/FeedsParaMapperWebTestCase.test, line 656
Common functionality for all Paragraphs Mapper tests.

Class

FeedsParaMapperWebTestCase
Test basic functionality via DrupalWebTestCase.

Code

protected function addTamperPlugins($source) {
  if (!isset($this->createdPlugins)) {
    $this->createdPlugins = array();
  }
  if ($this->multiValuedParagraph) {
    $settings = array(
      'settings[separator]' => '|',
    );
    $des = "Separate paragraphs";
    $plugin = $this
      ->addTamperPlugin($this->importer, $source, 'explode', $des, $settings);
    $this->createdPlugins[] = array(
      'source' => $source,
      'plugin' => $plugin,
    );
  }
  if ($this->multiValued) {
    $settings = array(
      'settings[separator]' => ',',
    );
    $des = "Separate values";
    $plugin = $this
      ->addTamperPlugin($this->importer, $source, 'explode', $des, $settings);
    $this->createdPlugins[] = array(
      'source' => $source,
      'plugin' => $plugin,
    );
  }
}