Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / themes / contrib / bootstrap / src / Plugin / Process / ManagedFile.php
1 <?php
2
3 namespace Drupal\bootstrap\Plugin\Process;
4
5 use Drupal\bootstrap\Utility\Element;
6 use Drupal\Core\Form\FormStateInterface;
7
8 /**
9  * Processes the "managed_file" element.
10  *
11  * @ingroup plugins_process
12  *
13  * @BootstrapProcess("managed_file")
14  */
15 class ManagedFile extends ProcessBase implements ProcessInterface {
16
17   /**
18    * {@inheritdoc}
19    */
20   public static function processElement(Element $element, FormStateInterface $form_state, array &$complete_form) {
21     $ajax_wrapper_id = $element->upload_button->getProperty('ajax')['wrapper'];
22     if ($prefix = $element->getProperty('prefix')) {
23       $prefix = preg_replace('/<div id="' . $ajax_wrapper_id . '">/', '<div id="' . $ajax_wrapper_id . '" class="form-group">', $prefix);
24       $element->setProperty('prefix', $prefix);
25     }
26   }
27
28 }