Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PluginBase.php

function PluginBase::preRenderFlattenData

Overrides ViewsPluginInterface::preRenderFlattenData

File

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

Class

PluginBase
Base class for any views plugin types.

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal