getAddedMediaItems example

// The form is posted via AJAX. When there are messages set during the     // validation or submission of the form, the messages need to be shown to     // the user.     $form['status_messages'] = [
      '#type' => 'status_messages',
    ];

    $form['#attributes']['class'] = [
      'js-media-library-add-form',
    ];

    $added_media = $this->getAddedMediaItems($form_state);
    if (empty($added_media)) {
      $form = $this->buildInputElement($form$form_state);
    }
    else {
      $form['#attributes']['data-input'] = 'true';

      // This deserves to be themeable, but it doesn't need to be its own "real"       // template.       $form['description'] = [
        '#type' => 'inline_template',
        '#template' => '<p>{{ text }}</p>',
        
Home | Imprint | This part of the site doesn't use cookies.