You are here

protected function FeedsMapperMultilingualFieldsTestCase::getMappingsInLanguage in Feeds 7.2

Adds mappings for each field in specified language.

Parameters

string $langcode: The code of the desired language.

int $start: The index number to start the array with. This must be specified in order to add mappings to the right index when calling FeedsWebTestCase::addMappings().

9 calls to FeedsMapperMultilingualFieldsTestCase::getMappingsInLanguage()
FeedsMapperMultilingualFieldsTestCase::testChangedLanguageImport in tests/feeds_mapper_multilingual_fields.test
Tests if values of fields in other languages are kept when not importing in that language.
FeedsMapperMultilingualFieldsTestCase::testChangedLanguageImportForExistingNode in tests/feeds_mapper_multilingual_fields.test
Tests if values of fields in other languages are kept when not importing in that language for nodes that were not created by Feeds.
FeedsMapperMultilingualFieldsTestCase::testClearOutValues in tests/feeds_mapper_multilingual_fields.test
Tests if values are cleared out when an empty value or no value is provided.
FeedsMapperMultilingualFieldsTestCase::testClearOutValuesWithDisabledLanguage in tests/feeds_mapper_multilingual_fields.test
Tests if values are cleared out when an empty value is provided for a language that got disabled.
FeedsMapperMultilingualFieldsTestCase::testDisabledLanguage in tests/feeds_mapper_multilingual_fields.test
Tests if fields are imported in LANGUAGE_NONE if the field's language gets disabled after configuring.

... See full list

File

tests/feeds_mapper_multilingual_fields.test, line 795
Contains FeedsMapperMultilingualFieldsTestCase.

Class

FeedsMapperMultilingualFieldsTestCase
Tests field mapping with multiple languages.

Code

protected function getMappingsInLanguage($langcode, $start = 2) {
  $mappings = array(
    $start => array(
      'source' => 'body',
      'target' => 'body',
    ),
    array(
      'source' => 'date',
      'target' => 'field_date:start',
    ),
    array(
      'source' => 'datestamp',
      'target' => 'field_datestamp:start',
    ),
    array(
      'source' => 'datetime',
      'target' => 'field_datetime:start',
    ),
    array(
      'source' => 'image',
      'target' => 'field_image:uri',
    ),
    array(
      'source' => 'image_alt',
      'target' => 'field_image:alt',
    ),
    array(
      'source' => 'image_title',
      'target' => 'field_image:title',
    ),
    array(
      'source' => 'link',
      'target' => 'field_link:url',
    ),
    array(
      'source' => 'list_boolean',
      'target' => 'field_list_boolean',
    ),
    array(
      'source' => 'number_decimal',
      'target' => 'field_number_decimal',
    ),
    array(
      'source' => 'number_float',
      'target' => 'field_number_float',
    ),
    array(
      'source' => 'number_integer',
      'target' => 'field_number_integer',
    ),
    array(
      'source' => 'term',
      'target' => 'field_category',
      'autocreate' => TRUE,
    ),
    array(
      'source' => 'text',
      'target' => 'field_text',
    ),
  );
  foreach ($mappings as &$mapping) {
    $mapping['field_language'] = $langcode;
  }
  return $mappings;
}