private function setURLValue()
    {
        if (!$this->URLSegment || ($this->isChanged('Title') && !$this->isChanged('URLSegment'))) {
            if ($this->ID > 0) {
                $Renamed = new Renamed();
                $Renamed->OldLink = $this->URLSegment;
                $Renamed->NewsID = $this->ID;
                $Renamed->write();

                $this->URLSegment = singleton('SiteTree')->generateURLSegment($this->Title);
                if (strpos($this->URLSegment, 'page-') === false) {
                    $URLSegment = $this->URLSegment;
                    if ($this->LookForExistingURLSegment($URLSegment)) {
                        $URLSegment = $this->URLSegment . '-' . $this->ID;
                    }
                    $this->URLSegment = $URLSegment;
                }
            }
        }
    }
private function setURLValue()
    {
        if (!$this->URLSegment || ($this->isChanged('Title') && !$this->isChanged('URLSegment'))) {
            if ($this->ID > 0) {
                $Renamed = new Renamed();
                $Renamed->OldLink = $this->URLSegment;
                $Renamed->NewsID = $this->ID;
                $Renamed->write();

                $this->URLSegment = singleton('SiteTree')->generateURLSegment($this->Title);
                if (strpos($this->URLSegment, 'page-') === false) {
                    $URLSegment = $this->URLSegment;
                    if ($this->LookForExistingURLSegment($URLSegment)) {
                        $URLSegment = $this->URLSegment . '-' . $this->ID;
                    }
                    $this->URLSegment = $URLSegment;
                }
            }
        }
    }
private function setURLValue ( ) { if ( ! $ this -> URLSegment || ( $ this -> isChanged ( 'Title' ) && ! $ this -> isChanged ( 'URLSegment' ) ) ) { if ( $ this -> ID > 0 ) { $ Renamed = new Renamed ( ) ; $ Renamed -> OldLink = $ this -> URLSegment ; $ Renamed -> NewsID = $ this -> ID ; $ Renamed -> write ( ) ; $ this -> URLSegment = singleton ( 'SiteTree' ) -> generateURLSegment ( $ this -> Title ) ; if ( strpos ( $ this -> URLSegment , 'page-' ) === false ) { $ URLSegment = $ this -> URLSegment ; if ( $ this -> LookForExistingURLSegment ( $ URLSegment ) ) { $ URLSegment = $ this -> URLSegment . '-' . $ this -> ID ; } $ this -> URLSegment = $ URLSegment ; } } } }
Setup the URLSegment for this item and create a Renamed Object if it's a rename-action.
Setup the URLSegment for this item and create a Renamed Object if it s a rename - action .