src/Contao/View/Contao2BackendView/ActionHandler/ParentedListViewShowAllHandler.php
private function renderHeaderFields($parentModel, EnvironmentInterface $environment)
    {
        $definition = $environment->getDataDefinition();
        $parentName = $definition->getBasicDefinition()->getParentDataProvider();
        $add        = [];
        $properties = $environment->getParentDataDefinition()->getPropertiesDefinition();
        foreach ($this->getViewSection($definition)->getListingConfig()->getHeaderPropertyNames() as $field) {
            $value = StringUtil::deserialize($parentModel->getProperty($field));

            if ('tstamp' === $field) {
                $value = date(Config::get('datimFormat'), $value);
            } else {
                $value = $this->renderParentProperty($environment, $properties->getProperty($field), $value);
            }

            // Add the field.
            if ('' !== $value) {
                $add[$this->translateHeaderColumnName($field, $parentName)] = $value;
            }
        }

        $event = new GetParentHeaderEvent($environment, $parentModel);
        $event->setAdditional($add);

        $environment->getEventDispatcher()->dispatch(GetParentHeaderEvent::NAME, $event);

        if (null !== !$event->getAdditional()) {
            $add = $event->getAdditional();
        }

        return \array_map(
            function ($value) {
                if (\is_array($value)) {
                    return $value[0];
                }
                return $value;
            },
            $add
        );
    }
private function renderHeaderFields($parentModel, EnvironmentInterface $environment)
    {
        $definition = $environment->getDataDefinition();
        $parentName = $definition->getBasicDefinition()->getParentDataProvider();
        $add        = [];
        $properties = $environment->getParentDataDefinition()->getPropertiesDefinition();
        foreach ($this->getViewSection($definition)->getListingConfig()->getHeaderPropertyNames() as $field) {
            $value = StringUtil::deserialize($parentModel->getProperty($field));

            if ('tstamp' === $field) {
                $value = date(Config::get('datimFormat'), $value);
            } else {
                $value = $this->renderParentProperty($environment, $properties->getProperty($field), $value);
            }

            // Add the field.
            if ('' !== $value) {
                $add[$this->translateHeaderColumnName($field, $parentName)] = $value;
            }
        }

        $event = new GetParentHeaderEvent($environment, $parentModel);
        $event->setAdditional($add);

        $environment->getEventDispatcher()->dispatch(GetParentHeaderEvent::NAME, $event);

        if (null !== !$event->getAdditional()) {
            $add = $event->getAdditional();
        }

        return \array_map(
            function ($value) {
                if (\is_array($value)) {
                    return $value[0];
                }
                return $value;
            },
            $add
        );
    }
private function renderHeaderFields ( $ parentModel , EnvironmentInterface $ environment ) { $ definition = $ environment -> getDataDefinition ( ) ; $ parentName = $ definition -> getBasicDefinition ( ) -> getParentDataProvider ( ) ; $ add = [ ] ; $ properties = $ environment -> getParentDataDefinition ( ) -> getPropertiesDefinition ( ) ; foreach ( $ this -> getViewSection ( $ definition ) -> getListingConfig ( ) -> getHeaderPropertyNames ( ) as $ field ) { $ value = StringUtil :: deserialize ( $ parentModel -> getProperty ( $ field ) ) ; if ( 'tstamp' === $ field ) { $ value = date ( Config :: get ( 'datimFormat' ) , $ value ) ; } else { $ value = $ this -> renderParentProperty ( $ environment , $ properties -> getProperty ( $ field ) , $ value ) ; } // Add the field. if ( '' !== $ value ) { $ add [ $ this -> translateHeaderColumnName ( $ field , $ parentName ) ] = $ value ; } } $ event = new GetParentHeaderEvent ( $ environment , $ parentModel ) ; $ event -> setAdditional ( $ add ) ; $ environment -> getEventDispatcher ( ) -> dispatch ( GetParentHeaderEvent :: NAME , $ event ) ; if ( null !== ! $ event -> getAdditional ( ) ) { $ add = $ event -> getAdditional ( ) ; } return \ array_map ( function ( $ value ) { if ( \ is_array ( $ value ) ) { return $ value [ 0 ] ; } return $ value ; } , $ add ) ; }
Render the header of the parent view with information from the parent table.

@param ModelInterface       $parentModel The parent model.
@param EnvironmentInterface $environment The environment.

@return array
Render the header of the parent view with information from the parent table .