class TextField
Same name in this branch
- 9 core/modules/config_translation/src/FormElement/Textfield.php \Drupal\config_translation\FormElement\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
Same name in other branches
- 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
- 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/modules/text/src/Plugin/migrate/field/d7/TextField.php \Drupal\text\Plugin\migrate\field\d7\TextField
- 10 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
Plugin annotation
@MigrateField(
id = "d6_text",
type_map = {
"text" = "text",
"text_long" = "text_long",
"text_with_summary" = "text_with_summary"
},
core = {6},
source_module = "text",
destination_module = "text",
)
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\d6\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
2 files declare their use of TextField
- TextFieldTest.php in core/
modules/ text/ tests/ src/ Unit/ Migrate/ d6/ TextFieldTest.php - TextFieldTest.php in core/
modules/ text/ tests/ src/ Unit/ Plugin/ migrate/ field/ d6/ 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/ d6/ TextField.php, line 24
Namespace
Drupal\text\Plugin\migrate\field\d6View source
class TextField extends FieldPluginBase {
/**
* {@inheritdoc}
*/
public function getFieldWidgetMap() {
return [
'text_textfield' => 'text_textfield',
];
}
/**
* {@inheritdoc}
*/
public function getFieldFormatterMap() {
return [
'default' => 'text_default',
'trimmed' => 'text_trimmed',
'plain' => 'basic_string',
];
}
/**
* {@inheritdoc}
*/
public function defineValueProcessPipeline(MigrationInterface $migration, $field_name, $field_info) {
$widget_type = $field_info['widget_type'] ?? $field_info['widget']['type'];
if ($widget_type == 'optionwidgets_onoff') {
$process = [
'value' => [
'plugin' => 'static_map',
'source' => 'value',
'default_value' => 0,
],
];
$checked_value = explode("\n", $field_info['global_settings']['allowed_values'])[1];
if (strpos($checked_value, '|') !== FALSE) {
$checked_value = substr($checked_value, 0, strpos($checked_value, '|'));
}
$process['value']['map'][$checked_value] = 1;
}
else {
// See \Drupal\migrate_drupal\Plugin\migrate\source\d6\User::baseFields(),
// signature_format for an example of the YAML that represents this
// process array.
$process = [
'value' => 'value',
'format' => [
[
'plugin' => 'static_map',
'bypass' => TRUE,
'source' => 'format',
'map' => [
0 => NULL,
],
],
[
'plugin' => 'skip_on_empty',
'method' => 'process',
],
[
'plugin' => 'migration_lookup',
'migration' => [
'd6_filter_format',
'd7_filter_format',
],
'source' => 'format',
],
],
];
}
$process = [
'plugin' => 'sub_process',
'source' => $field_name,
'process' => $process,
];
$migration->setProcessOfProperty($field_name, $process);
}
/**
* {@inheritdoc}
*/
public function getFieldType(Row $row) {
$widget_type = $row->getSourceProperty('widget_type');
$settings = $row->getSourceProperty('global_settings');
if ($widget_type == 'text_textfield') {
$field_type = $settings['text_processing'] ? 'text' : 'string';
if (empty($settings['max_length']) || $settings['max_length'] > 255) {
$field_type .= '_long';
}
return $field_type;
}
if ($widget_type == 'text_textarea') {
$field_type = $settings['text_processing'] ? 'text_long' : 'string_long';
return $field_type;
}
switch ($widget_type) {
case 'optionwidgets_buttons':
case 'optionwidgets_select':
return 'list_string';
case 'optionwidgets_onoff':
return 'boolean';
default:
return parent::getFieldType($row);
}
}
}
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::getFieldFormatterType | public | function | Get the field formatter type from the source. | Overrides MigrateFieldInterface::getFieldFormatterType | 1 |
FieldPluginBase::getFieldWidgetType | public | function | Get the field widget type from the source. | Overrides MigrateFieldInterface::getFieldWidgetType | 1 |
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::defineValueProcessPipeline | public | function | Apply any custom processing to the field bundle migrations. | Overrides FieldPluginBase::defineValueProcessPipeline | |
TextField::getFieldFormatterMap | public | function | Get a map between D6 formatters and D8 formatters for this field type. | Overrides FieldPluginBase::getFieldFormatterMap | |
TextField::getFieldType | public | function | Computes the destination type of a migrated field. | Overrides FieldPluginBase::getFieldType | |
TextField::getFieldWidgetMap | public | function | Get a map between D6 and D8 widgets for this field type. | Overrides FieldPluginBase::getFieldWidgetMap |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.