You are here

public static function ManagedFile::processElement in Open Social 8.3

Same name and namespace in other branches
  1. 8.9 themes/socialbase/src/Plugin/Process/ManagedFile.php \Drupal\socialbase\Plugin\Process\ManagedFile::processElement()
  2. 8 themes/socialbase/src/Plugin/Process/ManagedFile.php \Drupal\socialbase\Plugin\Process\ManagedFile::processElement()
  3. 8.2 themes/socialbase/src/Plugin/Process/ManagedFile.php \Drupal\socialbase\Plugin\Process\ManagedFile::processElement()
  4. 8.4 themes/socialbase/src/Plugin/Process/ManagedFile.php \Drupal\socialbase\Plugin\Process\ManagedFile::processElement()
  5. 8.5 themes/socialbase/src/Plugin/Process/ManagedFile.php \Drupal\socialbase\Plugin\Process\ManagedFile::processElement()
  6. 8.6 themes/socialbase/src/Plugin/Process/ManagedFile.php \Drupal\socialbase\Plugin\Process\ManagedFile::processElement()
  7. 8.7 themes/socialbase/src/Plugin/Process/ManagedFile.php \Drupal\socialbase\Plugin\Process\ManagedFile::processElement()
  8. 8.8 themes/socialbase/src/Plugin/Process/ManagedFile.php \Drupal\socialbase\Plugin\Process\ManagedFile::processElement()

Process a specific form element.

Parameters

\Drupal\bootstrap\Utility\Element $element: The element object.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

array $complete_form: The complete form structure.

Overrides ManagedFile::processElement

See also

\Drupal\bootstrap\Plugin\Process\ProcessBase::process()

\Drupal\bootstrap\Plugin\Alter\ElementInfo::alter()

File

themes/socialbase/src/Plugin/Process/ManagedFile.php, line 21

Class

ManagedFile
Processes the "managed_file" element.

Namespace

Drupal\socialbase\Plugin\Process

Code

public static function processElement(Element $element, FormStateInterface $form_state, array &$complete_form) {
  $ajax_wrapper_id = $element->upload_button
    ->getProperty('ajax')['wrapper'];
  if ($prefix = $element
    ->getProperty('prefix')) {
    $prefix = preg_replace('/<div id="' . $ajax_wrapper_id . '">/', '<div id="' . $ajax_wrapper_id . '">', $prefix);
    $element
      ->setProperty('prefix', $prefix);
  }
}