Answers for "Drupal 8 custom form image field"

PHP
0

Drupal 8 custom form image field

//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];
Posted by: Guest on October-12-2021

Code answers related to "Drupal 8 custom form image field"

Browse Popular Code Answers by Language