file ManagedFile.php

Namespace

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

Classes

Name Description
ManagedFile Processes the "managed_file" element.