public function TextField::getFieldFormatterType in Drupal 9
Same name and namespace in other branches
- 8 core/modules/text/src/Plugin/migrate/field/d7/TextField.php \Drupal\text\Plugin\migrate\field\d7\TextField::getFieldFormatterType()
Get the field formatter type from the source.
Parameters
\Drupal\migrate\Row $row: The field being migrated.
Return value
string The field formatter type.
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\d7Code
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', 'basic_string', $formatter_type);
break;
}
return $formatter_type;
}