code: 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;
      }
docs: Get the list of jumpTos based on the items.
  
  @param IMetaModel                             $metaModels The MetaModels to be used.
  
  @param IFilter                                $filter     The filter to be used.
  
  @param \MetaModels\Render\Setting\ICollection $view       The view to be used.
  
  @param string|null                            $rootPage   The root page id or null if there is no root page.
  
  @return array A list of urls for the jumpTos
  
  @SuppressWarnings(PHPMD.Superglobals)
  @SuppressWarnings(PHPMD.CamelCaseVariableName)