You are here

class LanguageTypes in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/language/src/Plugin/migrate/process/LanguageTypes.php \Drupal\language\Plugin\migrate\process\LanguageTypes
  2. 9 core/modules/language/src/Plugin/migrate/process/LanguageTypes.php \Drupal\language\Plugin\migrate\process\LanguageTypes

Processes the array for the language types.

Plugin annotation


@MigrateProcessPlugin(
  id = "language_types",
  handle_multiples = TRUE
)

Hierarchy

Expanded class hierarchy of LanguageTypes

1 file declares its use of LanguageTypes
LanguageTypesTest.php in core/modules/language/tests/src/Unit/process/LanguageTypesTest.php

File

core/modules/language/src/Plugin/migrate/process/LanguageTypes.php, line 18

Namespace

Drupal\language\Plugin\migrate\process
View source
class LanguageTypes extends ProcessPluginBase {

  /**
   * {@inheritdoc}
   */
  public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    if (!is_array($value)) {
      throw new MigrateException('The input should be an array');
    }
    if (array_key_exists('language', $value)) {
      $value['language_interface'] = $value['language'];
      unset($value['language']);
    }
    if (!empty($this->configuration['filter_configurable'])) {
      $value = array_filter($value);
    }
    return array_keys($value);
  }

}

Members