class TextField
Same name in this branch
- 10 core/modules/config_translation/src/FormElement/Textfield.php \Drupal\config_translation\FormElement\Textfield
- 10 core/modules/text/src/Plugin/migrate/field/d6/TextField.php \Drupal\text\Plugin\migrate\field\d6\TextField
- 10 core/lib/Drupal/Core/Render/Element/Textfield.php \Drupal\Core\Render\Element\Textfield
Same name in other branches
- 9 core/modules/config_translation/src/FormElement/Textfield.php \Drupal\config_translation\FormElement\Textfield
- 9 core/modules/text/src/Plugin/migrate/field/d6/TextField.php \Drupal\text\Plugin\migrate\field\d6\TextField
- 9 core/modules/text/src/Plugin/migrate/field/d7/TextField.php \Drupal\text\Plugin\migrate\field\d7\TextField
- 9 core/lib/Drupal/Core/Render/Element/Textfield.php \Drupal\Core\Render\Element\Textfield
- 8.9.x core/modules/config_translation/src/FormElement/Textfield.php \Drupal\config_translation\FormElement\Textfield
- 8.9.x core/modules/text/src/Plugin/migrate/field/d6/TextField.php \Drupal\text\Plugin\migrate\field\d6\TextField
- 8.9.x core/modules/text/src/Plugin/migrate/field/d7/TextField.php \Drupal\text\Plugin\migrate\field\d7\TextField
- 8.9.x core/modules/text/src/Plugin/migrate/cckfield/TextField.php \Drupal\text\Plugin\migrate\cckfield\TextField
- 8.9.x core/lib/Drupal/Core/Render/Element/Textfield.php \Drupal\Core\Render\Element\Textfield
- 11.x core/modules/config_translation/src/FormElement/Textfield.php \Drupal\config_translation\FormElement\Textfield
- 11.x core/modules/text/src/Plugin/migrate/field/d6/TextField.php \Drupal\text\Plugin\migrate\field\d6\TextField
- 11.x core/modules/text/src/Plugin/migrate/field/d7/TextField.php \Drupal\text\Plugin\migrate\field\d7\TextField
- 11.x core/lib/Drupal/Core/Render/Element/Textfield.php \Drupal\Core\Render\Element\Textfield
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
- class \Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\migrate_drupal\Plugin\MigrateFieldInterface
- class \Drupal\text\Plugin\migrate\field\d7\TextField extends \Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase
- class \Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\migrate_drupal\Plugin\MigrateFieldInterface
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
Expanded class hierarchy of TextField
1 file declares its use of TextField
- TextFieldTest.php in core/
modules/ text/ tests/ src/ Unit/ Plugin/ migrate/ field/ d7/ TextFieldTest.php
27 string references to 'TextField'
- ContentTranslationHandler::addTranslatabilityClue in core/
modules/ content_translation/ src/ ContentTranslationHandler.php - Adds a clue about the form element translatability.
- ElementTest::testPlaceHolderText in core/
modules/ system/ tests/ src/ Functional/ Form/ ElementTest.php - Tests placeholder text for elements that support placeholders.
- EntityDisplayFormBaseTest::testCopyFormValuesToEntity in core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityDisplayFormBaseTest.php - @covers ::copyFormValuesToEntity
- EntityField::multiple_options_form in core/
modules/ views/ src/ Plugin/ views/ field/ EntityField.php - Provide options for multiple value fields.
- FieldAttachOtherTest::testEntityFormDisplayBuildForm in core/
modules/ field/ tests/ src/ Kernel/ FieldAttachOtherTest.php - Tests \Drupal\Core\Entity\Display\EntityFormDisplayInterface::buildForm().
File
-
core/
modules/ text/ src/ Plugin/ migrate/ field/ d7/ TextField.php, line 10
Namespace
Drupal\text\Plugin\migrate\field\d7View source
class TextField extends FieldPluginBase {
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*/
public function getFieldType(Row $row) {
$type = $row->getSourceProperty('type');
$plain_text = FALSE;
$filtered_text = FALSE;
foreach ($row->getSourceProperty('instances') as $instance) {
// Check if this field has plain text instances, filtered text instances,
// or both.
$data = unserialize($instance['data']);
switch ($data['settings']['text_processing']) {
case '0':
$plain_text = TRUE;
break;
case '1':
$filtered_text = TRUE;
break;
}
}
if (in_array($type, [
'text',
'text_long',
])) {
// If a text or text_long field has only plain text instances, migrate it
// to a string or string_long field.
if ($plain_text && !$filtered_text) {
$type = str_replace([
'text',
'text_long',
], [
'string',
'string_long',
], $type);
}
elseif ($plain_text && $filtered_text) {
$field_name = $row->getSourceProperty('field_name');
throw new MigrateSkipRowException("Can't migrate source field {$field_name} configured with both plain text and filtered text processing. See https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#plain-text");
}
}
elseif ($type == 'text_with_summary' && $plain_text) {
// If a text_with_summary field has plain text instances, skip the row
// since there's no such thing as a string_with_summary field.
$field_name = $row->getSourceProperty('field_name');
throw new MigrateSkipRowException("Can't migrate source field {$field_name} of type text_with_summary configured with plain text processing. See https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#plain-text");
}
return $type;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
FieldPluginBase::alterFieldFormatterMigration | public | function | Apply any custom processing to the field formatter migration. | Overrides MigrateFieldInterface::alterFieldFormatterMigration | |
FieldPluginBase::alterFieldInstanceMigration | public | function | Apply any custom processing to the field instance migration. | Overrides MigrateFieldInterface::alterFieldInstanceMigration | 2 |
FieldPluginBase::alterFieldMigration | public | function | Apply any custom processing to the field migration. | Overrides MigrateFieldInterface::alterFieldMigration | |
FieldPluginBase::alterFieldWidgetMigration | public | function | Apply any custom processing to the field widget migration. | Overrides MigrateFieldInterface::alterFieldWidgetMigration | |
FieldPluginBase::defineValueProcessPipeline | public | function | Apply any custom processing to the field bundle migrations. | Overrides MigrateFieldInterface::defineValueProcessPipeline | 8 |
FieldPluginBase::getFieldFormatterMap | public | function | Get a map between D6 formatters and D8 formatters for this field type. | Overrides MigrateFieldInterface::getFieldFormatterMap | 11 |
FieldPluginBase::getFieldWidgetMap | public | function | Get a map between D6 and D8 widgets for this field type. | Overrides MigrateFieldInterface::getFieldWidgetMap | 8 |
PluginInspectionInterface::getPluginDefinition | public | function | Gets the definition of the plugin implementation. | 6 | |
PluginInspectionInterface::getPluginId | public | function | Gets the plugin ID of the plugin instance. | 2 | |
TextField::getFieldFormatterType | public | function | Get the field formatter type from the source. | Overrides FieldPluginBase::getFieldFormatterType | |
TextField::getFieldType | public | function | Computes the destination type of a migrated field. | Overrides FieldPluginBase::getFieldType | |
TextField::getFieldWidgetType | public | function | Get the field widget type from the source. | Overrides FieldPluginBase::getFieldWidgetType |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.