public static function remove(array &$form, FormStateInterface $form_state) {
    $el = static::el($form, $form_state);

    Upload::delete($el['fid']);

    $form_state->setValueForElement($el['fid'], NULL);
    NestedArray::setValue($form_state->getUserInput(), $el['fid']['#parents'], NULL);

    $form_state->setRebuild();
  }
public static function remove(array &$form, FormStateInterface $form_state) {
    $el = static::el($form, $form_state);

    Upload::delete($el['fid']);

    $form_state->setValueForElement($el['fid'], NULL);
    NestedArray::setValue($form_state->getUserInput(), $el['fid']['#parents'], NULL);

    $form_state->setRebuild();
  }
public static function remove ( array & $ form , FormStateInterface $ form_state ) { $ el = static :: el ( $ form , $ form_state ) ; Upload :: delete ( $ el [ 'fid' ] ) ; $ form_state -> setValueForElement ( $ el [ 'fid' ] , NULL ) ; NestedArray :: setValue ( $ form_state -> getUserInput ( ) , $ el [ 'fid' ] [ '#parents' ] , NULL ) ; $ form_state -> setRebuild ( ) ; }
Handles form submission when the Remove button is clicked.

@param array $form
The complete form.
@param \Drupal\Core\Form\FormStateInterface $form_state
The current form state.
Handles form submission when the Remove button is clicked .