You are here

protected function FeedsMapperMultilingualFieldsTestCase::setupMultilingual in Feeds 7.2

Sets given content type and fields to be translatable.

Parameters

string $typename: The machine name of the node type.

array $field_names: The fields to enable multilingual support for.

1 call to FeedsMapperMultilingualFieldsTestCase::setupMultilingual()
FeedsMapperMultilingualFieldsTestCase::setUp in tests/feeds_mapper_multilingual_fields.test
Sets up a Drupal site for running functional and integration tests.

File

tests/feeds_mapper_multilingual_fields.test, line 763
Contains FeedsMapperMultilingualFieldsTestCase.

Class

FeedsMapperMultilingualFieldsTestCase
Tests field mapping with multiple languages.

Code

protected function setupMultilingual($typename, array $field_names) {

  // Enable entity field translation for content type.
  $edit = array(
    'language_content_type' => 4,
    'entity_translation_hide_translation_links' => 1,
    'entity_translation_node_metadata' => 0,
  );
  $this
    ->drupalPost('admin/structure/types/manage/' . $typename, $edit, t('Save content type'));

  // Enable field translation on fields.
  $edit = array(
    'field[translatable]' => 1,
  );
  foreach ($field_names as $field_name) {
    $this
      ->drupalPost("admin/structure/types/manage/{$typename}/fields/{$field_name}", $edit, t('Save settings'));
  }

  // Reset static cache so that all languages are available when
  // field_available_languages() is called during node_load().
  drupal_static_reset();
}