Skip to main content
Improved answer.
Source Link
Mike Shiyan
  • 203
  • 1
  • 10

An Image type field should contain a file fid of an image file. Check what do you get in $form_state->getvalues()['image_dir'].The following should resolve your issue:

$img = $form_state->getValue('image_dir');

if (!empty($img['fids'])) {
  $img = reset($img['fids']);
}

An Image type field should contain a file fid of an image file. Check what do you get in $form_state->getvalues()['image_dir'].

An Image type field should contain a file fid of an image file. The following should resolve your issue:

$img = $form_state->getValue('image_dir');

if (!empty($img['fids'])) {
  $img = reset($img['fids']);
}
Source Link
Mike Shiyan
  • 203
  • 1
  • 10

An Image type field should contain a file fid of an image file. Check what do you get in $form_state->getvalues()['image_dir'].