📜  Drupal 8 自定义表单图像字段 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:43.902000             🧑  作者: Mango

代码示例1
//form build
$form['my_file'] = [
      '#type' => 'managed_file',
      '#title' => 'my file',
      '#name' => 'my_custom_file',
      '#description' => $this->t('my file description'),
      '#default_value' => [$config->get('my_file')],
      '#upload_location' => 'public://'
    ];

//form submit
$form_state->getValue('my_file')[0];