I'm developing a drupal module and there's a problem. I need to make a content type with some fields and one of them should have list with string values. But when I try to create content and choose new content type I created, I see list and there are values contains first symbol of the string that I need.
coursebook.info.yml
name: Course Book
description: Course book
type: module
core: 8.x
package: Course book module
field.storage.node.field_disciplines.yml
langcode: en
dependencies:
enforced:
module:
- coursebook
module:
- node
id: node.field_disciplines
field_name: field_disciplines
entity_type: node
type: list_string
settings:
allowed_values: { "1":'A', "2":'Bb', "3":'Cccc'}
max_length: 1000
module: core
locked: false
cardinality: 100
field.field.node.coursebook.field_disciplines.yml
langcode: en
dependencies:
config:
- field.storage.node.field_disciplines
- node.type.coursebook
id: node.coursebook.field_disciplines
field_name: field_disciplines
entity_type: node
bundle: coursebook
label: 'disciplines'
description: 'Type disciplines here'
required: false
default_value: 'example'
settings: { }
field_type: list_string
core.entity_view_display.node.coursebook.default.yml
langcode: en
status: true
dependencies:
config:
- field.field.node.coursebook.field_year
- field.field.node.coursebook.field_semester
- node.type.coursebook
id: node.coursebook.default
targetEntityType: node
bundle: coursebook
mode: default
content:
field_year:
label: hidden
type: string
weight: 0
settings: { }
third_party_settings: { }
field_semester:
label: hidden
type: string
weight: 1
settings: { }
third_party_settings: { }
field_disciplines:
label: hidden
type: string
weight: 2
settings: { }
third_party_settings: { }
core.entity_form_display.node.coursebook.default.yml
langcode: en
status: true
dependencies:
config:
- field.field.node.coursebook.field_year
- field.field.node.coursebook.field_semester
- node.type.coursebook
id: node.coursebook.default
targetEntityType: node
bundle: coursebook
mode: default
content:
field_year:
type: string_textfield
weight: 0
settings:
size: 30
placeholder: 'example'
third_party_settings: { }
field_semester:
type: string_textfield
weight: 1
settings:
size: 30
placeholder: 'example'
third_party_settings: { }
field_disciplines:
type: string_textfield
weight: 2
settings:
size: 30
placeholder: 'example'
third_party_settings: { }
hidden: { }
And what I see -
But i shuold see this list:
allowed_values: { "1":'A', "2":'Bb', "3":'Cccc'}
There are only files that describe problem field. I hope you understand my problem. I develop my module using this manual: https://medium.com/touch4it/custom-content-type-with-custom-fields-for-your-drupal-8-module-9478fd018f76