dialogOptions example


  public static function openMediaLibrary(array $form, FormStateInterface $form_state) {
    $triggering_element = $form_state->getTriggeringElement();
    $library_ui = \Drupal::service('media_library.ui_builder')->buildUi($triggering_element['#media_library_state']);
    $dialog_options = MediaLibraryUiBuilder::dialogOptions();
    return (new AjaxResponse())
      ->addCommand(new OpenModalDialogCommand($dialog_options['title']$library_ui$dialog_options));
  }

  /** * Validates that newly selected items can be added to the widget. * * Making an invalid selection from the view should not be possible, but we * still validate in case other selection methods (ex: upload) are valid. * * @param array $form * The form array. * @param \Drupal\Core\Form\FormStateInterface $form_state * The form state. */
Home | Imprint | This part of the site doesn't use cookies.