Commit d56b70cf authored by catch's avatar catch

Issue #2344979 by yched: Rename field type list_text to list_string.

parent 2c6cd929
......@@ -481,7 +481,7 @@ function list_field_views_data(FieldStorageConfigInterface $field_storage) {
$data[$table_name][$field_name]['filter']['id'] = 'field_list';
}
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';
}
else {
......
......@@ -334,7 +334,7 @@ function testFieldFormMultivalueWithRequiredRadio() {
entity_create('field_storage_config', array(
'name' => 'required_radio_test',
'entity_type' => 'entity_test',
'type' => 'list_text',
'type' => 'list_string',
'settings' => array(
'allowed_values' => array('yes' => 'yes', 'no' => 'no'),
),
......
......@@ -35,8 +35,8 @@ process:
optionwidgets_buttons: list_float
optionwidgets_onoff: boolean
text:
optionwidgets_select: list_text
optionwidgets_buttons: list_text
optionwidgets_select: list_string
optionwidgets_buttons: list_string
optionwidgets_onoff: boolean
text_textfield: text
text_textarea: text_long
......
......@@ -16,7 +16,7 @@ process:
checkbox: boolean
date: datetime
list: text
selection: list_text
selection: list_string
textfield: text
textarea: text_long
url: link
......
......@@ -53,7 +53,7 @@ public function getSettings($field_type, $global_settings, $widget_settings) {
$list = array_map('trim', $list);
$list = array_filter($list, 'strlen');
switch ($field_type) {
case 'list_text':
case 'list_string':
case 'list_integer':
case 'list_float':
foreach ($list as $value) {
......@@ -81,7 +81,7 @@ public function getSettings($field_type, $global_settings, $widget_settings) {
),
),
'datetime' => array('datetime_type' => 'datetime'),
'list_text' => array(
'list_string' => array(
'allowed_values' => $allowed_values,
),
'list_integer' => array(
......
......@@ -58,7 +58,7 @@ protected function setUp() {
entity_create('field_storage_config', array(
'entity_type' => 'user',
'name' => 'profile_sold_to',
'type' => 'list_text',
'type' => 'list_string',
'settings' => array(
'allowed_values' => array(
'Pill spammers' => 'Pill spammers',
......
......@@ -50,7 +50,7 @@ protected function setUp() {
entity_create('field_storage_config', array(
'entity_type' => 'user',
'name' => 'profile_sold_to',
'type' => 'list_text',
'type' => 'list_string',
))->save();
entity_create('field_storage_config', array(
'entity_type' => 'user',
......
......@@ -45,7 +45,7 @@ protected function setUp() {
entity_create('field_storage_config', array(
'entity_type' => 'user',
'name' => 'profile_sold_to',
'type' => 'list_text',
'type' => 'list_string',
))->save();
entity_create('field_storage_config', array(
'entity_type' => 'user',
......
......@@ -99,7 +99,7 @@ protected function createFields() {
'profile_color' => 'text',
'profile_biography' => 'text_long',
'profile_sell_address' => 'boolean',
'profile_sold_to' => 'list_text',
'profile_sold_to' => 'list_string',
'profile_bands' => 'text',
'profile_blog' => 'link',
'profile_birthdate' => 'datetime',
......
......@@ -53,7 +53,7 @@ public function testUserProfileFields() {
// Migrated selection field.
$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();
$this->assertEqual($settings['allowed_values'], array(
'Pill spammers' => 'Pill spammers',
......@@ -62,7 +62,7 @@ public function testUserProfileFields() {
'Faithful servant' => 'Faithful servant',
'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.
$field_storage = entity_load('field_storage_config', 'user.profile_bands');
......
......@@ -74,7 +74,7 @@ field.list_float.value:
type: string
label: 'Value'
field.list_text.storage_settings:
field.list_string.storage_settings:
type: mapping
label: 'List (text) settings'
mapping:
......@@ -95,12 +95,12 @@ field.list_text.storage_settings:
type: string
label: 'Allowed values function'
field.list_text.field_settings:
field.list_string.field_settings:
label: 'List (float)'
type: mapping
mapping: { }
field.list_text.value:
field.list_string.value:
type: sequence
label: 'Default value'
sequence:
......
......@@ -20,7 +20,7 @@
* field_types = {
* "list_integer",
* "list_float",
* "list_text",
* "list_string",
* }
* )
*/
......
......@@ -20,7 +20,7 @@
* field_types = {
* "list_integer",
* "list_float",
* "list_text",
* "list_string",
* }
* )
*/
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\options\Type\ListTextItem.
* Contains \Drupal\options\Type\ListStringItem.
*/
namespace Drupal\options\Plugin\Field\FieldType;
......@@ -11,17 +11,17 @@
use Drupal\Core\TypedData\DataDefinition;
/**
* Plugin implementation of the 'list_text' field type.
* Plugin implementation of the 'list_string' field type.
*
* @FieldType(
* id = "list_text",
* id = "list_string",
* 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."),
* default_widget = "options_select",
* default_formatter = "list_default",
* )
*/
class ListTextItem extends ListItemBase {
class ListStringItem extends ListItemBase {
/**
* {@inheritdoc}
......
......@@ -20,7 +20,7 @@
* "boolean",
* "list_integer",
* "list_float",
* "list_text",
* "list_string",
* },
* multiple_values = TRUE
* )
......
......@@ -20,7 +20,7 @@
* field_types = {
* "list_integer",
* "list_float",
* "list_text"
* "list_string"
* },
* multiple_values = TRUE
* )
......
......@@ -35,7 +35,7 @@ protected function setUp() {
entity_create('field_storage_config', array(
'name' => $this->field_name,
'entity_type' => 'entity_test_rev',
'type' => 'list_text',
'type' => 'list_string',
'cardinality' => 1,
'settings' => array(
'allowed_values_function' => 'options_test_dynamic_values_callback',
......
......@@ -166,7 +166,7 @@ function testOptionsAllowedValuesFloat() {
*/
function testOptionsAllowedValuesText() {
$this->field_name = 'field_options_text';
$this->createOptionsField('list_text');
$this->createOptionsField('list_string');
// Flat list of textual values.
$string = "Zero\nOne";
......@@ -231,7 +231,7 @@ function testOptionsAllowedValuesText() {
*/
function testOptionsTrimmedValuesText() {
$this->field_name = 'field_options_trimmed_text';
$this->createOptionsField('list_text');
$this->createOptionsField('list_string');
// Explicit keys.
$string = "zero |Zero\none | One";
......@@ -243,7 +243,7 @@ function testOptionsTrimmedValuesText() {
* Helper function to create list field of a given type.
*
* @param string $type
* 'list_integer', 'list_float' or 'list_text'
* 'list_integer', 'list_float' or 'list_string'
*/
protected function createOptionsField($type) {
// Create a field.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment