/**
  * Processes elements that have input groups.
  *
  * @param \Drupal\materialize\Utility\Element $element
  *   The element object.
  * @param \Drupal\Core\Form\FormStateInterface $form_state
  *   The current state of the form.
  * @param array $complete_form
  *   The complete form structure.
  */
 protected static function processInputGroups(Element $element, FormStateInterface $form_state, array &$complete_form)
 {
     // Automatically inject the nearest button found after this element if
     // #input_group_button exists.
     if ($element->getProperty('input_group_button')) {
         // Obtain the parent array to limit search.
         $array_parents = $element->getProperty('array_parents', []);
         // Remove the current element from the array.
         array_pop($array_parents);
         // Retrieve the parent element.
         $parent = Element::create(NestedArray::getValue($complete_form, $array_parents), $form_state);
         // Find the closest button.
         if ($button = self::findButton($parent)) {
             $element->appendProperty('field_suffix', $button->setIcon());
             $button->setProperty('access', FALSE);
         }
     }
     $input_group_attributes = ['class' => ['input-group-' . ($element->getProperty('input_group_button') ? 'btn' : 'addon')]];
     if ($prefix = $element->getProperty('field_prefix')) {
         $element->setProperty('field_prefix', ['#type' => 'html_tag', '#tag' => 'span', '#attributes' => $input_group_attributes, '#value' => Element::create($prefix)->render(), '#weight' => -1]);
     }
     if ($suffix = $element->getProperty('field_suffix')) {
         $element->setProperty('field_suffix', ['#type' => 'html_tag', '#tag' => 'span', '#attributes' => $input_group_attributes, '#value' => Element::create($suffix)->render(), '#weight' => 1]);
     }
 }