src/Contao/View/Contao2BackendView/Subscriber/GetGroupHeaderSubscriber.php
public function handle(GetGroupHeaderEvent $event)
    {
        if ((null !== $event->getValue()) || !$this->scopeDeterminator->currentScopeIsBackend()) {
            return;
        }

        $environment = $event->getEnvironment();
        $property    = $environment
            ->getDataDefinition()
            ->getPropertiesDefinition()
            ->getProperty($event->getGroupField());

        // No property? Get out!
        if (!$property) {
            $event->setValue('-');
            return;
        }

        $value = $this->formatGroupHeader(
            $environment,
            $event->getModel(),
            $property,
            $event->getGroupingMode(),
            $event->getGroupingLength()
        );

        if (null !== $value) {
            $event->setValue($value);
        }
    }
public function handle(GetGroupHeaderEvent $event)
    {
        if ((null !== $event->getValue()) || !$this->scopeDeterminator->currentScopeIsBackend()) {
            return;
        }

        $environment = $event->getEnvironment();
        $property    = $environment
            ->getDataDefinition()
            ->getPropertiesDefinition()
            ->getProperty($event->getGroupField());

        // No property? Get out!
        if (!$property) {
            $event->setValue('-');
            return;
        }

        $value = $this->formatGroupHeader(
            $environment,
            $event->getModel(),
            $property,
            $event->getGroupingMode(),
            $event->getGroupingLength()
        );

        if (null !== $value) {
            $event->setValue($value);
        }
    }
public function handle ( GetGroupHeaderEvent $ event ) { if ( ( null !== $ event -> getValue ( ) ) || ! $ this -> scopeDeterminator -> currentScopeIsBackend ( ) ) { return ; } $ environment = $ event -> getEnvironment ( ) ; $ property = $ environment -> getDataDefinition ( ) -> getPropertiesDefinition ( ) -> getProperty ( $ event -> getGroupField ( ) ) ; // No property? Get out! if ( ! $ property ) { $ event -> setValue ( '-' ) ; return ; } $ value = $ this -> formatGroupHeader ( $ environment , $ event -> getModel ( ) , $ property , $ event -> getGroupingMode ( ) , $ event -> getGroupingLength ( ) ) ; if ( null !== $ value ) { $ event -> setValue ( $ value ) ; } }
Handle the subscribed event.

@param GetGroupHeaderEvent $event The event.

@return void
Handle the subscribed event .