Skip to content
Snippets Groups Projects

Issue #3206256: Ability to mark options as required

1 unresolved thread

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
339 342 '#description' => $this->t($def['description']),
340 343 '#type' => 'select',
341 344 '#options' => $this->translateOptions($def['options']),
342 '#empty_option' => $this->t('- None -'),
343 '#empty_value' => '',
344 345 '#default_value' => $default,
345 346 ];
346 347 if ($def['multi']) {
347 348 $formRenderArray['#multiple'] = TRUE;
348 349 }
350 if (isset($def['required'])) {
351 $formRenderArray['#required'] = $def['required'];
352 }
353 else {
354 $emptyOption = !empty($def['empty_option']) ? $def['empty_option'] : '- None -';
  • empty_option and empty_value should not be related to require. This is handled in the select render element.

    Also if no empty_option is provided do not set it and then it will rely on the render element default behavior.

  • Please register or sign in to reply
Please register or sign in to reply
Loading