You are here

public function ExtraFieldManager::formAlter in Account field split 8

Same name and namespace in other branches
  1. 2.x src/ExtraFieldManager.php \Drupal\account_field_split\ExtraFieldManager::formAlter()

Do form alter.

File

src/ExtraFieldManager.php, line 22

Class

ExtraFieldManager
Class ExtraFieldManager.

Namespace

Drupal\account_field_split

Code

public function formAlter(array &$form, FormStateInterface &$form_state, $form_id) {
  if (isset($form['account']) && is_array($form['account'])) {
    $account_elements = Element::children($form['account']);
    foreach ($account_elements as $account_element) {
      if (isset($form['account'][$account_element])) {
        $form[$account_element] = $form['account'][$account_element];
        unset($form['account'][$account_element]);
      }
    }
  }
}