Issue #2344979 by yched: Rename field type list_text to list_string.
parent
2c6cd92958
commit
d56b70cffa
|
@ -481,7 +481,7 @@ function list_field_views_data(FieldStorageConfigInterface $field_storage) {
|
||||||
$data[$table_name][$field_name]['filter']['id'] = 'field_list';
|
$data[$table_name][$field_name]['filter']['id'] = 'field_list';
|
||||||
}
|
}
|
||||||
if (isset($field_data['argument']) && $field_name != 'delta') {
|
if (isset($field_data['argument']) && $field_name != 'delta') {
|
||||||
if ($field_storage->getType() == 'list_text') {
|
if ($field_storage->getType() == 'list_string') {
|
||||||
$data[$table_name][$field_name]['argument']['id'] = 'field_list_string';
|
$data[$table_name][$field_name]['argument']['id'] = 'field_list_string';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -334,7 +334,7 @@ class FormTest extends FieldTestBase {
|
||||||
entity_create('field_storage_config', array(
|
entity_create('field_storage_config', array(
|
||||||
'name' => 'required_radio_test',
|
'name' => 'required_radio_test',
|
||||||
'entity_type' => 'entity_test',
|
'entity_type' => 'entity_test',
|
||||||
'type' => 'list_text',
|
'type' => 'list_string',
|
||||||
'settings' => array(
|
'settings' => array(
|
||||||
'allowed_values' => array('yes' => 'yes', 'no' => 'no'),
|
'allowed_values' => array('yes' => 'yes', 'no' => 'no'),
|
||||||
),
|
),
|
||||||
|
|
|
@ -35,8 +35,8 @@ process:
|
||||||
optionwidgets_buttons: list_float
|
optionwidgets_buttons: list_float
|
||||||
optionwidgets_onoff: boolean
|
optionwidgets_onoff: boolean
|
||||||
text:
|
text:
|
||||||
optionwidgets_select: list_text
|
optionwidgets_select: list_string
|
||||||
optionwidgets_buttons: list_text
|
optionwidgets_buttons: list_string
|
||||||
optionwidgets_onoff: boolean
|
optionwidgets_onoff: boolean
|
||||||
text_textfield: text
|
text_textfield: text
|
||||||
text_textarea: text_long
|
text_textarea: text_long
|
||||||
|
|
|
@ -16,7 +16,7 @@ process:
|
||||||
checkbox: boolean
|
checkbox: boolean
|
||||||
date: datetime
|
date: datetime
|
||||||
list: text
|
list: text
|
||||||
selection: list_text
|
selection: list_string
|
||||||
textfield: text
|
textfield: text
|
||||||
textarea: text_long
|
textarea: text_long
|
||||||
url: link
|
url: link
|
||||||
|
|
|
@ -53,7 +53,7 @@ class FieldSettings extends ProcessPluginBase {
|
||||||
$list = array_map('trim', $list);
|
$list = array_map('trim', $list);
|
||||||
$list = array_filter($list, 'strlen');
|
$list = array_filter($list, 'strlen');
|
||||||
switch ($field_type) {
|
switch ($field_type) {
|
||||||
case 'list_text':
|
case 'list_string':
|
||||||
case 'list_integer':
|
case 'list_integer':
|
||||||
case 'list_float':
|
case 'list_float':
|
||||||
foreach ($list as $value) {
|
foreach ($list as $value) {
|
||||||
|
@ -81,7 +81,7 @@ class FieldSettings extends ProcessPluginBase {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'datetime' => array('datetime_type' => 'datetime'),
|
'datetime' => array('datetime_type' => 'datetime'),
|
||||||
'list_text' => array(
|
'list_string' => array(
|
||||||
'allowed_values' => $allowed_values,
|
'allowed_values' => $allowed_values,
|
||||||
),
|
),
|
||||||
'list_integer' => array(
|
'list_integer' => array(
|
||||||
|
|
|
@ -58,7 +58,7 @@ class MigrateProfileValuesTest extends MigrateDrupalTestBase {
|
||||||
entity_create('field_storage_config', array(
|
entity_create('field_storage_config', array(
|
||||||
'entity_type' => 'user',
|
'entity_type' => 'user',
|
||||||
'name' => 'profile_sold_to',
|
'name' => 'profile_sold_to',
|
||||||
'type' => 'list_text',
|
'type' => 'list_string',
|
||||||
'settings' => array(
|
'settings' => array(
|
||||||
'allowed_values' => array(
|
'allowed_values' => array(
|
||||||
'Pill spammers' => 'Pill spammers',
|
'Pill spammers' => 'Pill spammers',
|
||||||
|
|
|
@ -50,7 +50,7 @@ class MigrateUserProfileEntityDisplayTest extends MigrateDrupalTestBase {
|
||||||
entity_create('field_storage_config', array(
|
entity_create('field_storage_config', array(
|
||||||
'entity_type' => 'user',
|
'entity_type' => 'user',
|
||||||
'name' => 'profile_sold_to',
|
'name' => 'profile_sold_to',
|
||||||
'type' => 'list_text',
|
'type' => 'list_string',
|
||||||
))->save();
|
))->save();
|
||||||
entity_create('field_storage_config', array(
|
entity_create('field_storage_config', array(
|
||||||
'entity_type' => 'user',
|
'entity_type' => 'user',
|
||||||
|
|
|
@ -45,7 +45,7 @@ class MigrateUserProfileEntityFormDisplayTest extends MigrateDrupalTestBase {
|
||||||
entity_create('field_storage_config', array(
|
entity_create('field_storage_config', array(
|
||||||
'entity_type' => 'user',
|
'entity_type' => 'user',
|
||||||
'name' => 'profile_sold_to',
|
'name' => 'profile_sold_to',
|
||||||
'type' => 'list_text',
|
'type' => 'list_string',
|
||||||
))->save();
|
))->save();
|
||||||
entity_create('field_storage_config', array(
|
entity_create('field_storage_config', array(
|
||||||
'entity_type' => 'user',
|
'entity_type' => 'user',
|
||||||
|
|
|
@ -99,7 +99,7 @@ class MigrateUserProfileFieldInstanceTest extends MigrateDrupalTestBase {
|
||||||
'profile_color' => 'text',
|
'profile_color' => 'text',
|
||||||
'profile_biography' => 'text_long',
|
'profile_biography' => 'text_long',
|
||||||
'profile_sell_address' => 'boolean',
|
'profile_sell_address' => 'boolean',
|
||||||
'profile_sold_to' => 'list_text',
|
'profile_sold_to' => 'list_string',
|
||||||
'profile_bands' => 'text',
|
'profile_bands' => 'text',
|
||||||
'profile_blog' => 'link',
|
'profile_blog' => 'link',
|
||||||
'profile_birthdate' => 'datetime',
|
'profile_birthdate' => 'datetime',
|
||||||
|
|
|
@ -53,7 +53,7 @@ class MigrateUserProfileFieldTest extends MigrateDrupalTestBase {
|
||||||
|
|
||||||
// Migrated selection field.
|
// Migrated selection field.
|
||||||
$field_storage = entity_load('field_storage_config', 'user.profile_sold_to');
|
$field_storage = entity_load('field_storage_config', 'user.profile_sold_to');
|
||||||
$this->assertEqual($field_storage->type, 'list_text', 'Field type is list_text.');
|
$this->assertEqual($field_storage->type, 'list_string', 'Field type is list_string.');
|
||||||
$settings = $field_storage->getSettings();
|
$settings = $field_storage->getSettings();
|
||||||
$this->assertEqual($settings['allowed_values'], array(
|
$this->assertEqual($settings['allowed_values'], array(
|
||||||
'Pill spammers' => 'Pill spammers',
|
'Pill spammers' => 'Pill spammers',
|
||||||
|
@ -62,7 +62,7 @@ class MigrateUserProfileFieldTest extends MigrateDrupalTestBase {
|
||||||
'Faithful servant' => 'Faithful servant',
|
'Faithful servant' => 'Faithful servant',
|
||||||
'Anonymous donor' => 'Anonymous donor',
|
'Anonymous donor' => 'Anonymous donor',
|
||||||
));
|
));
|
||||||
$this->assertEqual($field_storage->type, 'list_text', 'Field type is list_text.');
|
$this->assertEqual($field_storage->type, 'list_string', 'Field type is list_string.');
|
||||||
|
|
||||||
// Migrated list field.
|
// Migrated list field.
|
||||||
$field_storage = entity_load('field_storage_config', 'user.profile_bands');
|
$field_storage = entity_load('field_storage_config', 'user.profile_bands');
|
||||||
|
|
|
@ -74,7 +74,7 @@ field.list_float.value:
|
||||||
type: string
|
type: string
|
||||||
label: 'Value'
|
label: 'Value'
|
||||||
|
|
||||||
field.list_text.storage_settings:
|
field.list_string.storage_settings:
|
||||||
type: mapping
|
type: mapping
|
||||||
label: 'List (text) settings'
|
label: 'List (text) settings'
|
||||||
mapping:
|
mapping:
|
||||||
|
@ -95,12 +95,12 @@ field.list_text.storage_settings:
|
||||||
type: string
|
type: string
|
||||||
label: 'Allowed values function'
|
label: 'Allowed values function'
|
||||||
|
|
||||||
field.list_text.field_settings:
|
field.list_string.field_settings:
|
||||||
label: 'List (float)'
|
label: 'List (float)'
|
||||||
type: mapping
|
type: mapping
|
||||||
mapping: { }
|
mapping: { }
|
||||||
|
|
||||||
field.list_text.value:
|
field.list_string.value:
|
||||||
type: sequence
|
type: sequence
|
||||||
label: 'Default value'
|
label: 'Default value'
|
||||||
sequence:
|
sequence:
|
||||||
|
|
|
@ -20,7 +20,7 @@ use Drupal\Core\Field\FieldItemListInterface;
|
||||||
* field_types = {
|
* field_types = {
|
||||||
* "list_integer",
|
* "list_integer",
|
||||||
* "list_float",
|
* "list_float",
|
||||||
* "list_text",
|
* "list_string",
|
||||||
* }
|
* }
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,7 +20,7 @@ use Drupal\Core\Field\FieldItemListInterface;
|
||||||
* field_types = {
|
* field_types = {
|
||||||
* "list_integer",
|
* "list_integer",
|
||||||
* "list_float",
|
* "list_float",
|
||||||
* "list_text",
|
* "list_string",
|
||||||
* }
|
* }
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Contains \Drupal\options\Type\ListTextItem.
|
* Contains \Drupal\options\Type\ListStringItem.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Drupal\options\Plugin\Field\FieldType;
|
namespace Drupal\options\Plugin\Field\FieldType;
|
||||||
|
@ -11,17 +11,17 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||||
use Drupal\Core\TypedData\DataDefinition;
|
use Drupal\Core\TypedData\DataDefinition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin implementation of the 'list_text' field type.
|
* Plugin implementation of the 'list_string' field type.
|
||||||
*
|
*
|
||||||
* @FieldType(
|
* @FieldType(
|
||||||
* id = "list_text",
|
* id = "list_string",
|
||||||
* label = @Translation("List (text)"),
|
* label = @Translation("List (text)"),
|
||||||
* description = @Translation("This field stores text values from a list of allowed 'value => label' pairs, i.e. 'US States': IL => Illinois, IA => Iowa, IN => Indiana."),
|
* description = @Translation("This field stores text values from a list of allowed 'value => label' pairs, i.e. 'US States': IL => Illinois, IA => Iowa, IN => Indiana."),
|
||||||
* default_widget = "options_select",
|
* default_widget = "options_select",
|
||||||
* default_formatter = "list_default",
|
* default_formatter = "list_default",
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
class ListTextItem extends ListItemBase {
|
class ListStringItem extends ListItemBase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
|
@ -20,7 +20,7 @@ use Drupal\Core\Form\FormStateInterface;
|
||||||
* "boolean",
|
* "boolean",
|
||||||
* "list_integer",
|
* "list_integer",
|
||||||
* "list_float",
|
* "list_float",
|
||||||
* "list_text",
|
* "list_string",
|
||||||
* },
|
* },
|
||||||
* multiple_values = TRUE
|
* multiple_values = TRUE
|
||||||
* )
|
* )
|
||||||
|
|
|
@ -20,7 +20,7 @@ use Drupal\options\Plugin\Field\FieldWidget\OptionsWidgetBase;
|
||||||
* field_types = {
|
* field_types = {
|
||||||
* "list_integer",
|
* "list_integer",
|
||||||
* "list_float",
|
* "list_float",
|
||||||
* "list_text"
|
* "list_string"
|
||||||
* },
|
* },
|
||||||
* multiple_values = TRUE
|
* multiple_values = TRUE
|
||||||
* )
|
* )
|
||||||
|
|
|
@ -35,7 +35,7 @@ abstract class OptionsDynamicValuesTestBase extends FieldTestBase {
|
||||||
entity_create('field_storage_config', array(
|
entity_create('field_storage_config', array(
|
||||||
'name' => $this->field_name,
|
'name' => $this->field_name,
|
||||||
'entity_type' => 'entity_test_rev',
|
'entity_type' => 'entity_test_rev',
|
||||||
'type' => 'list_text',
|
'type' => 'list_string',
|
||||||
'cardinality' => 1,
|
'cardinality' => 1,
|
||||||
'settings' => array(
|
'settings' => array(
|
||||||
'allowed_values_function' => 'options_test_dynamic_values_callback',
|
'allowed_values_function' => 'options_test_dynamic_values_callback',
|
||||||
|
|
|
@ -166,7 +166,7 @@ class OptionsFieldUITest extends FieldTestBase {
|
||||||
*/
|
*/
|
||||||
function testOptionsAllowedValuesText() {
|
function testOptionsAllowedValuesText() {
|
||||||
$this->field_name = 'field_options_text';
|
$this->field_name = 'field_options_text';
|
||||||
$this->createOptionsField('list_text');
|
$this->createOptionsField('list_string');
|
||||||
|
|
||||||
// Flat list of textual values.
|
// Flat list of textual values.
|
||||||
$string = "Zero\nOne";
|
$string = "Zero\nOne";
|
||||||
|
@ -231,7 +231,7 @@ class OptionsFieldUITest extends FieldTestBase {
|
||||||
*/
|
*/
|
||||||
function testOptionsTrimmedValuesText() {
|
function testOptionsTrimmedValuesText() {
|
||||||
$this->field_name = 'field_options_trimmed_text';
|
$this->field_name = 'field_options_trimmed_text';
|
||||||
$this->createOptionsField('list_text');
|
$this->createOptionsField('list_string');
|
||||||
|
|
||||||
// Explicit keys.
|
// Explicit keys.
|
||||||
$string = "zero |Zero\none | One";
|
$string = "zero |Zero\none | One";
|
||||||
|
@ -243,7 +243,7 @@ class OptionsFieldUITest extends FieldTestBase {
|
||||||
* Helper function to create list field of a given type.
|
* Helper function to create list field of a given type.
|
||||||
*
|
*
|
||||||
* @param string $type
|
* @param string $type
|
||||||
* 'list_integer', 'list_float' or 'list_text'
|
* 'list_integer', 'list_float' or 'list_string'
|
||||||
*/
|
*/
|
||||||
protected function createOptionsField($type) {
|
protected function createOptionsField($type) {
|
||||||
// Create a field.
|
// Create a field.
|
||||||
|
|
Loading…
Reference in New Issue