protected function getJumpTosFor($metaModels, $filter, $view, $rootPage = null)
    {
        $entries = array();

        // Get the object.
        $items = $metaModels->findByFilter($filter);

        /** @var Item $item */
        foreach ($items as $item) {
            $jumpTo = $item->buildJumpToLink($view);
            $event  = new GetPageDetailsEvent($jumpTo['page']);
            $this->getEventDispatcher()->dispatch(ContaoEvents::CONTROLLER_GET_PAGE_DETAILS, $event);
            $pageDetails = $event->getPageDetails();

            // If there is a root page check the context or if we have no page continue.
            if ($pageDetails === null || ($rootPage !== null && $pageDetails['rootId'] != $rootPage)) {
                continue;
            }

            // Build the url.
            $url = $this->getBaseUrl(
                $pageDetails,
                $jumpTo['url']
            );

            $entries[] = $url->getUrl();
        }

        return $entries;
    }