You are here

public static function PluginBase::preRenderFlattenData in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/PluginBase.php \Drupal\views\Plugin\views\PluginBase::preRenderFlattenData()
  2. 9 core/modules/views/src/Plugin/views/PluginBase.php \Drupal\views\Plugin\views\PluginBase::preRenderFlattenData()

File

core/modules/views/src/Plugin/views/PluginBase.php, line 501

Class

PluginBase

Namespace

Drupal\views\Plugin\views

Code

public static function preRenderFlattenData($form) {
  foreach (Element::children($form) as $key) {
    $element = $form[$key];
    if (!empty($element['#flatten'])) {
      foreach (Element::children($element) as $child_key) {
        $form[$child_key] = $form[$key][$child_key];
      }

      // All done, remove the now-empty parent.
      unset($form[$key]);
    }
  }
  return $form;
}