You are here

public function TextField::getFieldWidgetType in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/text/src/Plugin/migrate/field/d7/TextField.php \Drupal\text\Plugin\migrate\field\d7\TextField::getFieldWidgetType()
  2. 9 core/modules/text/src/Plugin/migrate/field/d7/TextField.php \Drupal\text\Plugin\migrate\field\d7\TextField::getFieldWidgetType()

Get the field widget type from the source.

Parameters

\Drupal\migrate\Row $row: The field being migrated.

Return value

string The field widget type.

Overrides FieldPluginBase::getFieldWidgetType

File

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

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 getFieldWidgetType(Row $row) {
  $field_type = $this
    ->getFieldType($row);
  $widget_type = $row
    ->getSourceProperty('widget/type');
  switch ($field_type) {
    case 'string':
      $widget_type = str_replace('text_textfield', 'string_textfield', $widget_type);
      break;
    case 'string_long':
      $widget_type = str_replace('text_textarea', 'string_textarea', $widget_type);
      break;
  }
  return $widget_type;
}