original_string: public function route($var = null)
      {
          if ($var !== null) {
              $this->route = $var;
          }
  
          if (empty($this->route)) {
              $baseRoute = null;
  
              // calculate route based on parent slugs
              $parent = $this->parent();
              if (isset($parent)) {
                  if ($this->hide_home_route && $parent->route() === $this->home_route) {
                      $baseRoute = '';
                  } else {
                      $baseRoute = (string)$parent->route();
                  }
              }
  
              $this->route = isset($baseRoute) ? $baseRoute . '/' . $this->slug() : null;
  
              if (!empty($this->routes) && isset($this->routes['default'])) {
                  $this->routes['aliases'][] = $this->route;
                  $this->route = $this->routes['default'];
  
                  return $this->route;
              }
          }
  
          return $this->route;
      }
code: public function route($var = null)
      {
          if ($var !== null) {
              $this->route = $var;
          }
  
          if (empty($this->route)) {
              $baseRoute = null;
  
              // calculate route based on parent slugs
              $parent = $this->parent();
              if (isset($parent)) {
                  if ($this->hide_home_route && $parent->route() === $this->home_route) {
                      $baseRoute = '';
                  } else {
                      $baseRoute = (string)$parent->route();
                  }
              }
  
              $this->route = isset($baseRoute) ? $baseRoute . '/' . $this->slug() : null;
  
              if (!empty($this->routes) && isset($this->routes['default'])) {
                  $this->routes['aliases'][] = $this->route;
                  $this->route = $this->routes['default'];
  
                  return $this->route;
              }
          }
  
          return $this->route;
      }
code_tokens: public function route ( $ var = null ) { if ( $ var !== null ) { $ this -> route = $ var ; } if ( empty ( $ this -> route ) ) { $ baseRoute = null ; // calculate route based on parent slugs $ parent = $ this -> parent ( ) ; if ( isset ( $ parent ) ) { if ( $ this -> hide_home_route && $ parent -> route ( ) === $ this -> home_route ) { $ baseRoute = '' ; } else { $ baseRoute = ( string ) $ parent -> route ( ) ; } } $ this -> route = isset ( $ baseRoute ) ? $ baseRoute . '/' . $ this -> slug ( ) : null ; if ( ! empty ( $ this -> routes ) && isset ( $ this -> routes [ 'default' ] ) ) { $ this -> routes [ 'aliases' ] [ ] = $ this -> route ; $ this -> route = $ this -> routes [ 'default' ] ; return $ this -> route ; } } return $ this -> route ; }
docstring: Gets the route for the page based on the route headers if available, else from
  the parents route and the current Page's slug.
  
  @param  string $var Set new default route.
  
  @return string  The route for the Page.
docstring_tokens: Gets the route for the page based on the route headers if available else from the parents route and the current Page s slug .