3
0
Fork 0
mirror of https://github.com/farmOS/farmOS.git synced 2024-02-23 11:37:38 +01:00

Fix string form/view display config.

This commit is contained in:
Michael Stenta 2020-12-10 13:22:47 -05:00
parent f1fd5b0dfb
commit 5b3d757f2f

View file

@ -447,14 +447,23 @@ function farm_field_base_field_definition_entity_reference(BaseFieldDefinition &
*/
function farm_field_base_field_definition_string(BaseFieldDefinition &$field, array $options = []) {
// Set default settings.
$field->setSetting('max_length', 255);
$field->setSetting('is_ascii', FALSE);
$field->setSetting('case_sensitive', FALSE);
// Build form and view display settings.
$field->setDisplayOptions('form', [
'type' => $options['type'],
'type' => 'string_textfield',
'settings' => [
'size' => 60,
'placeholder' => '',
],
'weight' => $options['weight']['form'] ?? 0,
]);
$field->setDisplayOptions('view', [
'label' => 'inline',
'type' => $options['type'],
'type' => 'string',
'weight' => $options['weight']['view'] ?? 0,
]);
}