I’ve a content material sort with a picture area. I must validate this area as a result of I must verify if consumer add an actual picture or solely a file with picture’s extension (like jpg, gif, png and so on). I’ve tried and readed 100+ issues however none resolve my downside.
I’ve tried by way of “#upload_validators” with this code:
foreach ($kind['field_all_images'][$form['field_all_images']['#language']] as $ok => $v) { if (!is_integer($ok)) proceed; $kind['field_all_images'][$form['field_all_images']['#language']][$k]['#upload_validators']['check_image_correct'] = array(); }
the place “check_image_correct()” is a my customized perform that checks by way of imagegetinfo()
. My downside, on this “strive/case”, is that Drupal Development Service perform works/known as just for Drupal Development Service first picture. I’ve tried to maneuver this perform from hook_form_alter()
to an #after_build
perform, with out end result (solely Drupal Development Service first time it really works).