Issue #3516520 Add language default value
1 unresolved thread
Closes #3516520
Merge request reports
Activity
940 940 type: timestamp 941 941 label: 'Value' 942 942 943 field.value.language: 944 type: mapping 945 label: 'Language value' 946 mapping: 947 value: 948 type: string 949 label: 'Language value' - Comment on lines +948 to +949
Looking at
\Drupal\Core\Field\Plugin\Field\FieldWidget\LanguageSelectWidget::formElement()
and\Drupal\Core\Field\Plugin\Field\FieldType\LanguageItem::generateSampleValue()
, the allowed set of lang really depends on configuration, but nonetheless, this is currently accepting arbitrary strings, when we could be restricting it to actual langcodes at least: Good point!
But could this be also empty/null?
Because langcode has a NotNull constraint, and
getAllValidLangcodes()
wouldn't allow an empty stringlangcode: type: string label: 'Language code' constraints: NotNull: [] Choice: callback: 'Drupal\Core\TypedData\Plugin\DataType\LanguageReference::getAllValidLangcodes'
added 7 commits
-
d7837a3e...622e3cc1 - 4 commits from branch
project:11.x
- bbbe6e56 - Add language default value
- bc60497e - Test fix
- 7f15ebee - Add a constraint
Toggle commit list-
d7837a3e...622e3cc1 - 4 commits from branch
Please register or sign in to reply