findLocalizedPage() public method

See if a localized version of this page exists if there is no difference we return null
public findLocalizedPage ( Page $page ) : Page
$page Page
return Page
Example #1
0
 /**
  * Displays details of a page
  *
  * @return Response
  */
 public function show()
 {
     // what does it mean to be in editing mode? right now it is just when you are logged in
     $editing = !is_null(\Auth::user());
     //&& Input::get('editing', false);
     $pageVersionHash = $this->Input->get('page_version_share', null);
     $pageVersionName = $this->Input->get('page_version', null);
     $page = $pageVersionHash ? $this->PagesRepository->findByRouteNameAndPreviewHash($this->Route->currentRouteName(), $pageVersionHash) : $this->PagesRepository->findByRouteName($this->Route->currentRouteName(), $pageVersionName, $editing);
     $localized = $this->PagesRepository->findLocalizedPage($page);
     return $localized ? $this->Redirect->route($localized->route_name) : $this->retrieveResponse($page);
 }
Example #2
0
 /**
  * Displays details of a page
  *
  * @return Response
  */
 public function show()
 {
     // what does it mean to be in editing mode? right now it is just when you are logged in
     $editing = \DeviseUser::checkConditions('canUseDeviseEditor');
     //&& Input::get('editing', false);
     $pageVersionHash = $this->Input->get('page_version_share', null);
     $pageVersionName = $this->Input->get('page_version', null);
     $page = $pageVersionHash ? $this->PagesRepository->findByRouteNameAndPreviewHash($this->Route->currentRouteName(), $pageVersionHash) : $this->PagesRepository->findByRouteName($this->Route->currentRouteName(), $pageVersionName, $editing);
     $localized = $this->PagesRepository->findLocalizedPage($page);
     return $localized ? $this->retrieveLocalRedirect($localized) : $this->retrieveResponse($page);
 }