public function getBackendLayoutForPage(int $uid) {
    $rootLine = $this->pageRepository->getRootLine($uid);

    if ($rootLine) {
      $index = -1;

      foreach($rootLine as $page) {
        $index++;

        $backendLayout             = $page['backend_layout'];
        $hasBackendLayout          = false;
        $backendLayoutNextLevel    = $page['backend_layout_next_level'];
        $hasBackendLayoutNextLevel = false;

        if (!empty($backendLayout)) {
          $backendLayout = str_replace(self::BACKEND_LAYOUT_PREFIX, '', $backendLayout);
        }

        if (!empty($backendLayout) && $backendLayout != '-1') {
          $hasBackendLayout = true;
        }

        if (!empty($backendLayoutNextLevel)) {
          $backendLayoutNextLevel = str_replace(self::BACKEND_LAYOUT_PREFIX, '', $backendLayoutNextLevel);
        }

        if (!empty($backendLayoutNextLevel) && $backendLayoutNextLevel != '-1') {
          $hasBackendLayoutNextLevel = true;
        }

        if ($index == 0 && $hasBackendLayout) {
          return $backendLayout;
        } elseif ($index > 0 && $hasBackendLayoutNextLevel) {
          return $backendLayoutNextLevel;
        }
      }
    }

    return null;
  }
public function getBackendLayoutForPage(int $uid) {
    $rootLine = $this->pageRepository->getRootLine($uid);

    if ($rootLine) {
      $index = -1;

      foreach($rootLine as $page) {
        $index++;

        $backendLayout             = $page['backend_layout'];
        $hasBackendLayout          = false;
        $backendLayoutNextLevel    = $page['backend_layout_next_level'];
        $hasBackendLayoutNextLevel = false;

        if (!empty($backendLayout)) {
          $backendLayout = str_replace(self::BACKEND_LAYOUT_PREFIX, '', $backendLayout);
        }

        if (!empty($backendLayout) && $backendLayout != '-1') {
          $hasBackendLayout = true;
        }

        if (!empty($backendLayoutNextLevel)) {
          $backendLayoutNextLevel = str_replace(self::BACKEND_LAYOUT_PREFIX, '', $backendLayoutNextLevel);
        }

        if (!empty($backendLayoutNextLevel) && $backendLayoutNextLevel != '-1') {
          $hasBackendLayoutNextLevel = true;
        }

        if ($index == 0 && $hasBackendLayout) {
          return $backendLayout;
        } elseif ($index > 0 && $hasBackendLayoutNextLevel) {
          return $backendLayoutNextLevel;
        }
      }
    }

    return null;
  }
public function getBackendLayoutForPage ( int $ uid ) { $ rootLine = $ this -> pageRepository -> getRootLine ( $ uid ) ; if ( $ rootLine ) { $ index = - 1 ; foreach ( $ rootLine as $ page ) { $ index ++ ; $ backendLayout = $ page [ 'backend_layout' ] ; $ hasBackendLayout = false ; $ backendLayoutNextLevel = $ page [ 'backend_layout_next_level' ] ; $ hasBackendLayoutNextLevel = false ; if ( ! empty ( $ backendLayout ) ) { $ backendLayout = str_replace ( self :: BACKEND_LAYOUT_PREFIX , '' , $ backendLayout ) ; } if ( ! empty ( $ backendLayout ) && $ backendLayout != '-1' ) { $ hasBackendLayout = true ; } if ( ! empty ( $ backendLayoutNextLevel ) ) { $ backendLayoutNextLevel = str_replace ( self :: BACKEND_LAYOUT_PREFIX , '' , $ backendLayoutNextLevel ) ; } if ( ! empty ( $ backendLayoutNextLevel ) && $ backendLayoutNextLevel != '-1' ) { $ hasBackendLayoutNextLevel = true ; } if ( $ index == 0 && $ hasBackendLayout ) { return $ backendLayout ; } elseif ( $ index > 0 && $ hasBackendLayoutNextLevel ) { return $ backendLayoutNextLevel ; } } } return null ; }
Gets the backend layout for a page.

@param int $uid The UID of the page
@return string|null The backend layout or null if no backend layout was found
Gets the backend layout for a page .