public function layout(string $layout = null): View
    {
        // If no layout has been set
        if (null === $layout) {
            // Set to null
            return $this->withoutLayout();
        }

        // If we should be tracking layout changes
        if ($this->trackLayoutChanges) {
            // Set the flag
            $this->hasLayoutChanged = true;
        }

        $this->layout     = $layout;
        $this->layoutPath = $this->getFullPath($layout);

        return $this;
    }
public function layout(string $layout = null): View
    {
        // If no layout has been set
        if (null === $layout) {
            // Set to null
            return $this->withoutLayout();
        }

        // If we should be tracking layout changes
        if ($this->trackLayoutChanges) {
            // Set the flag
            $this->hasLayoutChanged = true;
        }

        $this->layout     = $layout;
        $this->layoutPath = $this->getFullPath($layout);

        return $this;
    }
public function layout ( string $ layout = null ) : View { // If no layout has been set if ( null === $ layout ) { // Set to null return $ this -> withoutLayout ( ) ; } // If we should be tracking layout changes if ( $ this -> trackLayoutChanges ) { // Set the flag $ this -> hasLayoutChanged = true ; } $ this -> layout = $ layout ; $ this -> layoutPath = $ this -> getFullPath ( $ layout ) ; return $ this ; }
Set the layout for the view template.

@param string $layout [optional] The layout to set

@throws InvalidConfigPath

@return \Valkyrja\View\View
Set the layout for the view template .