8ec543f4bda024d8a02185a8ccd7172dde46e3e1
[yaffs-website] / web / themes / contrib / bootstrap / src / Plugin / Process / ProcessBase.php
1 <?php
2 /**
3  * @file
4  * Contains \Drupal\bootstrap\Plugin\Process\ProcessBase.
5  */
6
7 namespace Drupal\bootstrap\Plugin\Process;
8
9 use Drupal\bootstrap\Plugin\PluginBase;
10 use Drupal\bootstrap\Utility\Element;
11 use Drupal\Core\Form\FormStateInterface;
12
13 /**
14  * Base process class used to process elements.
15  *
16  * @ingroup plugins_process
17  */
18 class ProcessBase extends PluginBase implements ProcessInterface {
19
20   /**
21    * {@inheritdoc}
22    */
23   public static function process(array $element, FormStateInterface $form_state, array &$complete_form) {
24     if (!empty($element['#bootstrap_ignore_process'])) {
25       return $element;
26     }
27     static::processElement(Element::create($element, $form_state), $form_state, $complete_form);
28     return $element;
29   }
30
31   /**
32    * Process a specific form element.
33    *
34    * @param \Drupal\bootstrap\Utility\Element $element
35    *   The element object.
36    * @param \Drupal\Core\Form\FormStateInterface $form_state
37    *   The current state of the form.
38    * @param array $complete_form
39    *   The complete form structure.
40    *
41    * @see \Drupal\bootstrap\Plugin\Process\ProcessBase::process()
42    * @see \Drupal\bootstrap\Plugin\Alter\ElementInfo::alter()
43    */
44   public static function processElement(Element $element, FormStateInterface $form_state, array &$complete_form) {}
45
46 }