public function generateURLSegment($increment = 0)
    {
        $increment = (int) $increment;
        $filter = URLSegmentFilter::create();

        // Setting this to on. Because of the UI flow, it would be quite a lot of work
        // to support turning this off. (ie. the add by title flow would not work).
        // If this becomes a problem we can approach it then.
        // @see https://github.com/silverstripe/silverstripe-blog/issues/376
        $filter->setAllowMultibyte(true);

        $this->URLSegment = $filter->filter($this->Title);

        if ($increment > 0) {
            $this->URLSegment .= '-' . $increment;
        }

        if ($this->getDuplicatesByField('URLSegment')->count() > 0) {
            $this->generateURLSegment($increment + 1);
        }

        return $this->URLSegment;
    }
public function generateURLSegment($increment = 0)
    {
        $increment = (int) $increment;
        $filter = URLSegmentFilter::create();

        // Setting this to on. Because of the UI flow, it would be quite a lot of work
        // to support turning this off. (ie. the add by title flow would not work).
        // If this becomes a problem we can approach it then.
        // @see https://github.com/silverstripe/silverstripe-blog/issues/376
        $filter->setAllowMultibyte(true);

        $this->URLSegment = $filter->filter($this->Title);

        if ($increment > 0) {
            $this->URLSegment .= '-' . $increment;
        }

        if ($this->getDuplicatesByField('URLSegment')->count() > 0) {
            $this->generateURLSegment($increment + 1);
        }

        return $this->URLSegment;
    }
public function generateURLSegment ( $ increment = 0 ) { $ increment = ( int ) $ increment ; $ filter = URLSegmentFilter :: create ( ) ; // Setting this to on. Because of the UI flow, it would be quite a lot of work // to support turning this off. (ie. the add by title flow would not work). // If this becomes a problem we can approach it then. // @see https://github.com/silverstripe/silverstripe-blog/issues/376 $ filter -> setAllowMultibyte ( true ) ; $ this -> URLSegment = $ filter -> filter ( $ this -> Title ) ; if ( $ increment > 0 ) { $ this -> URLSegment .= '-' . $ increment ; } if ( $ this -> getDuplicatesByField ( 'URLSegment' ) -> count ( ) > 0 ) { $ this -> generateURLSegment ( $ increment + 1 ) ; } return $ this -> URLSegment ; }
Generates a unique URLSegment from the title.

@param int $increment

@return string
Generates a unique URLSegment from the title .