function TextField::getFieldWidgetType

Same name in other branches
  1. 9 core/modules/text/src/Plugin/migrate/field/d7/TextField.php \Drupal\text\Plugin\migrate\field\d7\TextField::getFieldWidgetType()
  2. 10 core/modules/text/src/Plugin/migrate/field/d7/TextField.php \Drupal\text\Plugin\migrate\field\d7\TextField::getFieldWidgetType()
  3. 11.x core/modules/text/src/Plugin/migrate/field/d7/TextField.php \Drupal\text\Plugin\migrate\field\d7\TextField::getFieldWidgetType()

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;
}

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