protected function viewTree($collection)
    {
        $definition      = $this->getDataDefinition();
        $listing         = $this->getViewSection()->getListingConfig();
        $basicDefinition = $definition->getBasicDefinition();
        $environment     = $this->getEnvironment();
        $dispatcher      = $environment->getEventDispatcher();

        // Init some Vars
        switch (6) {
            case 6:
                $treeClass = 'tree_xtnd';
                break;

            default:
                $treeClass = 'tree';
        }

        // Label + Icon.
        if (null === $listing->getRootLabel()) {
            $labelText = 'DC General Tree BackendView Ultimate';
        } else {
            $labelText = $listing->getRootLabel();
        }

        if (null === $listing->getRootIcon()) {
            $labelIcon = 'pagemounts.svg';
        } else {
            $labelIcon = $listing->getRootIcon();
        }

        $filter = new Filter();
        $filter->andModelIsFromProvider($basicDefinition->getDataProvider());
        if ($parentDataProviderName = $basicDefinition->getParentDataProvider()) {
            $filter->andParentIsFromProvider($parentDataProviderName);
        } else {
            $filter->andHasNoParent();
        }

        // Root paste into.
        if ($environment->getClipboard()->isNotEmpty($filter)) {
            /** @var AddToUrlEvent $urlEvent */
            $urlEvent = $dispatcher->dispatch(
                ContaoEvents::BACKEND_ADD_TO_URL,
                new AddToUrlEvent(
                    \sprintf(
                        'act=paste&amp;into=%s::0',
                        $definition->getName()
                    )
                )
            );

            $buttonEvent = new GetPasteRootButtonEvent($this->getEnvironment());
            $buttonEvent
                ->setHref($urlEvent->getUrl())
                ->setPasteDisabled(false);

            $dispatcher->dispatch($buttonEvent::NAME, $buttonEvent);

            $rootPasteInto = static::renderPasteRootButton($buttonEvent);
        } else {
            $rootPasteInto = '';
        }

        /** @var GenerateHtmlEvent $imageEvent */
        $imageEvent = $dispatcher->dispatch(ContaoEvents::IMAGE_GET_HTML, new GenerateHtmlEvent($labelIcon));

        // Build template.
        $template = $this->getTemplate('dcbe_general_treeview');
        $template
            ->set('treeClass', 'tl_' . $treeClass)
            ->set('tableName', $definition->getName())
            ->set('strLabelIcon', $imageEvent->getHtml())
            ->set('strLabelText', $labelText)
            ->set('strHTML', $this->generateTreeView($collection, $treeClass))
            ->set('strRootPasteinto', $rootPasteInto)
            ->set('select', $this->isSelectModeActive())
            ->set('selectButtons', $this->getSelectButtons())
            ->set('intMode', 6);

        $this->formActionForSelect($template);

        // Add breadcrumb, if we have one.
        if (null !== ($breadcrumb = $this->breadcrumb())) {
            $template->set('breadcrumb', $breadcrumb);
        }

        return $template->parse();
    }