Tôi đã lập trình thêm một trường người dùng nhưng tôi không thể tìm cách kích hoạt lập trình trường theo 'quản lý hiển thị biểu mẫu' và 'quản lý hiển thị'.
Tôi đã thử xuất cấu hình 'hiển thị chế độ xem thực thể' và 'hiển thị biểu mẫu thực thể' như được thấy bên dưới nhưng nó sẽ không cho phép tôi cài đặt mô-đun bằng phương pháp này
Hiển thị biểu mẫu thực thể:
uuid: ecd2bd45-26ec-4fee-835a-eedc20a1dbf9
langcode: en
status: true
dependencies:
config:
- field.field.user.user.field_birthdate_pixelpin
- field.field.user.user.field_country_pixelpin
- field.field.user.user.field_family_name_pixelpin
- field.field.user.user.field_gender_pixelpin
- field.field.user.user.field_given_name_pixelpin
- field.field.user.user.field_nickname_pixelpin
- field.field.user.user.field_phone_number_pixelpin
- field.field.user.user.field_postal_code_pixelpin
- field.field.user.user.field_region_pixelpin
- field.field.user.user.field_street_address_pixelpin
- field.field.user.user.field_town_city_pixelpin
- field.field.user.user.user_picture
- image.style.thumbnail
module:
- image
- user
_core:
default_config_hash: LLAieeozVsoZDb-2PbFxRJpQqnKmpR7-4OoRJnduz-U
id: user.user.default
targetEntityType: user
bundle: user
mode: default
content:
account:
weight: 0
settings: { }
third_party_settings: { }
contact:
weight: 3
settings: { }
third_party_settings: { }
field_birthdate_pixelpin:
type: string_textfield
weight: 5
settings:
size: 60
placeholder: ''
third_party_settings: { }
field_country_pixelpin:
type: string_textfield
weight: 6
settings:
size: 60
placeholder: ''
third_party_settings: { }
field_family_name_pixelpin:
type: string_textfield
weight: 7
settings:
size: 60
placeholder: ''
third_party_settings: { }
field_gender_pixelpin:
type: string_textfield
weight: 8
settings:
size: 60
placeholder: ''
third_party_settings: { }
field_given_name_pixelpin:
type: string_textfield
weight: 9
settings:
size: 60
placeholder: ''
third_party_settings: { }
field_nickname_pixelpin:
type: string_textfield
weight: 10
settings:
size: 60
placeholder: ''
third_party_settings: { }
field_phone_number_pixelpin:
type: string_textfield
weight: 11
settings:
size: 60
placeholder: ''
third_party_settings: { }
field_postal_code_pixelpin:
type: string_textfield
weight: 12
settings:
size: 60
placeholder: ''
third_party_settings: { }
field_region_pixelpin:
type: string_textfield
weight: 13
settings:
size: 60
placeholder: ''
third_party_settings: { }
field_street_address_pixelpin:
type: string_textfield
weight: 14
settings:
size: 60
placeholder: ''
third_party_settings: { }
field_town_city_pixelpin:
type: string_textfield
weight: 15
settings:
size: 60
placeholder: ''
third_party_settings: { }
language:
weight: 2
settings: { }
third_party_settings: { }
timezone:
weight: 4
settings: { }
third_party_settings: { }
user_picture:
type: image_image
settings:
progress_indicator: throbber
preview_image_style: thumbnail
third_party_settings: { }
weight: 1
hidden: { }
Hiển thị thực thể:
uuid: 7ae755fd-5988-446f-beb5-2c9725b10c30
langcode: en
status: true
dependencies:
config:
- field.field.user.user.field_birthdate_pixelpin
- field.field.user.user.field_country_pixelpin
- field.field.user.user.field_family_name_pixelpin
- field.field.user.user.field_gender_pixelpin
- field.field.user.user.field_given_name_pixelpin
- field.field.user.user.field_nickname_pixelpin
- field.field.user.user.field_phone_number_pixelpin
- field.field.user.user.field_postal_code_pixelpin
- field.field.user.user.field_region_pixelpin
- field.field.user.user.field_street_address_pixelpin
- field.field.user.user.field_town_city_pixelpin
- field.field.user.user.user_picture
- image.style.thumbnail
module:
- image
- user
_core:
default_config_hash: L2mtwGWH_7wDRCMIR4r_Iu_jmvQ10DV1L8ht8iNZ5qY
id: user.user.default
targetEntityType: user
bundle: user
mode: default
content:
field_birthdate_pixelpin:
type: string
weight: 2
label: above
settings:
link_to_entity: false
third_party_settings: { }
field_country_pixelpin:
type: string
weight: 3
label: above
settings:
link_to_entity: false
third_party_settings: { }
field_family_name_pixelpin:
type: string
weight: 4
label: above
settings:
link_to_entity: false
third_party_settings: { }
field_gender_pixelpin:
type: string
weight: 5
label: above
settings:
link_to_entity: false
third_party_settings: { }
field_given_name_pixelpin:
type: string
weight: 6
label: above
settings:
link_to_entity: false
third_party_settings: { }
field_nickname_pixelpin:
type: string
weight: 7
label: above
settings:
link_to_entity: false
third_party_settings: { }
field_phone_number_pixelpin:
type: string
weight: 8
label: above
settings:
link_to_entity: false
third_party_settings: { }
field_postal_code_pixelpin:
type: string
weight: 9
label: above
settings:
link_to_entity: false
third_party_settings: { }
field_region_pixelpin:
type: string
weight: 10
label: above
settings:
link_to_entity: false
third_party_settings: { }
field_street_address_pixelpin:
type: string
weight: 11
label: above
settings:
link_to_entity: false
third_party_settings: { }
field_town_city_pixelpin:
type: string
weight: 12
label: above
settings:
link_to_entity: false
third_party_settings: { }
member_for:
weight: 1
settings: { }
third_party_settings: { }
user_picture:
type: image
weight: 0
settings:
image_style: thumbnail
image_link: content
third_party_settings: { }
label: hidden
hidden: { }
Có cách nào để làm điều này trong Drupal 8 không?
tôi đã cố gắng chỉnh sửa các trường hiện có bằng cách này nhưng không hoạt động:
function openid_connet_entity_edit(){
\Drupal::entityTypeManager()
->getStorage('entity_view_display')
->load('user.user.default')
->setComponent('field_birthdate_pixelpin', [
'format' => 'plain text'
])->save();
\Drupal::entityTypeManager()
->getStorage('entity_form_display')
->load('user.user.default')
->setComponent('field_birthdate_pixelpin', [
'Widget' => 'textfield'
])->save();
}