function TextField::getFieldFormatterType

Overrides FieldPluginBase::getFieldFormatterType

File

core/modules/text/src/Plugin/migrate/field/d7/TextField.php, line 27

Class

TextField
Plugin annotation @MigrateField( id = "d7_text", type_map = { "text" = "text", "text_long" = "text_long", "text_with_summary" = "text_with_summary" }, core = {7}, source_module = "text", destination_module = "text", )

Namespace

Drupal\text\Plugin\migrate\field\d7

Code

public function getFieldFormatterType(Row $row) {
  $field_type = $this->getFieldType($row);
  $formatter_type = $row->getSourceProperty('formatter/type');
  switch ($field_type) {
    case 'string':
      $formatter_type = str_replace([
        'text_default',
        'text_plain',
      ], 'string', $formatter_type);
      break;

    case 'string_long':
      $formatter_type = str_replace([
        'text_default',
        'text_plain',
      ], 'basic_string', $formatter_type);
      break;

  }
  return $formatter_type;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.