如何从多值字段获取值?

时间:2019-05-02 14:00:46

标签: drupal-8 drupal-forms

我有一个带有多值entity_autocomplete字段的表单。提交表单后,我想检索值。

这在buildForm函数中:

  $form['course_data_participant']['participant'] = [
      '#type' => 'entity_autocomplete',
      '#title' => t('Participant'),
      '#target_type' => 'user',
      '#selection_settings' => [
        'include_anonymous' => FALSE,
      ],
      '#multivalue' => TRUE,
      '#validate_reference' => FALSE,
      '#size' => '90',
      '#maxlength' => '100',
    ];

我使用以下方法来检索SubmitForm函数中的值:

$participant_id = $values['participant'];

$ form_state数组显示值在$ input数组中,但不在$ values数组中,仅显示最后输入的值。如何获取所有值?

0 个答案:

没有答案