public function blocks(\SS_HTTPRequest $request)
 {
     $page = null;
     /** @var \Page|HasBlocks $page */
     if ($pageID = $request->param('PageID')) {
         $page = \Page::get()->byID($pageID);
     } else {
         if ($path = Application::path_for_request($request)) {
             $page = Application::page_for_path($path);
         }
     }
     if ($page) {
         if ($page->hasExtension(\Modular\Relationships\HasBlocks::class_name())) {
             \Director::set_current_page($page);
             /** @var \GridListBlock $gridList */
             if ($gridListBlock = $page->Blocks()->find('ClassName', 'GridListBlock')) {
                 return $gridListBlock->renderWith("GridListItems");
             }
         }
     }
 }
 /**
  * Try to get page from Director and if in CMS then get it from CMS page, fallback to
  * Controller url via page_for_path.
  *
  * @return \DataObject|\Page|\SiteTree
  */
 public static function get_current_page()
 {
     $page = null;
     if (\Director::is_ajax()) {
         if ($path = self::path_for_request(\Controller::curr()->getRequest())) {
             $page = self::page_for_path($path);
         }
     } else {
         if ($page = \Director::get_current_page()) {
             if ($page instanceof \CMSMain) {
                 $page = $page->currentPage();
             }
         }
         if (!$page && ($controller = Controller::curr())) {
             if ($controller = Controller::curr()) {
                 if ($request = $controller->getRequest()) {
                     $page = Application::page_for_path($request->getURL());
                 }
             }
         }
     }
     return $page;
 }