public function getAnchor()
    {
        if ($this->anchor !== null) {
            return $this->anchor;
        }

        $anchorTitle = '';

        if (!$this->config()->disable_pretty_anchor_name) {
            if ($this->hasMethod('getAnchorTitle')) {
                $anchorTitle = $this->getAnchorTitle();
            } elseif ($this->config()->enable_title_in_template) {
                $anchorTitle = $this->getField('Title');
            }
        }

        if (!$anchorTitle) {
            $anchorTitle = 'e'.$this->ID;
        }

        $filter = URLSegmentFilter::create();
        $titleAsURL = $filter->filter($anchorTitle);

        // Ensure that this anchor name isn't already in use
        // ie. If two elemental blocks have the same title, it'll append '-2', '-3'
        $result = $titleAsURL;
        $count = 1;
        while (isset(self::$used_anchors[$result]) && self::$used_anchors[$result] !== $this->ID) {
            ++$count;
            $result = $titleAsURL . '-' . $count;
        }
        self::$used_anchors[$result] = $this->ID;
        return $this->anchor = $result;
    }
public function getAnchor()
    {
        if ($this->anchor !== null) {
            return $this->anchor;
        }

        $anchorTitle = '';

        if (!$this->config()->disable_pretty_anchor_name) {
            if ($this->hasMethod('getAnchorTitle')) {
                $anchorTitle = $this->getAnchorTitle();
            } elseif ($this->config()->enable_title_in_template) {
                $anchorTitle = $this->getField('Title');
            }
        }

        if (!$anchorTitle) {
            $anchorTitle = 'e'.$this->ID;
        }

        $filter = URLSegmentFilter::create();
        $titleAsURL = $filter->filter($anchorTitle);

        // Ensure that this anchor name isn't already in use
        // ie. If two elemental blocks have the same title, it'll append '-2', '-3'
        $result = $titleAsURL;
        $count = 1;
        while (isset(self::$used_anchors[$result]) && self::$used_anchors[$result] !== $this->ID) {
            ++$count;
            $result = $titleAsURL . '-' . $count;
        }
        self::$used_anchors[$result] = $this->ID;
        return $this->anchor = $result;
    }
public function getAnchor ( ) { if ( $ this -> anchor !== null ) { return $ this -> anchor ; } $ anchorTitle = '' ; if ( ! $ this -> config ( ) -> disable_pretty_anchor_name ) { if ( $ this -> hasMethod ( 'getAnchorTitle' ) ) { $ anchorTitle = $ this -> getAnchorTitle ( ) ; } elseif ( $ this -> config ( ) -> enable_title_in_template ) { $ anchorTitle = $ this -> getField ( 'Title' ) ; } } if ( ! $ anchorTitle ) { $ anchorTitle = 'e' . $ this -> ID ; } $ filter = URLSegmentFilter :: create ( ) ; $ titleAsURL = $ filter -> filter ( $ anchorTitle ) ; // Ensure that this anchor name isn't already in use // ie. If two elemental blocks have the same title, it'll append '-2', '-3' $ result = $ titleAsURL ; $ count = 1 ; while ( isset ( self :: $ used_anchors [ $ result ] ) && self :: $ used_anchors [ $ result ] !== $ this -> ID ) { ++ $ count ; $ result = $ titleAsURL . '-' . $ count ; } self :: $ used_anchors [ $ result ] = $ this -> ID ; return $ this -> anchor = $ result ; }
Get a unique anchor name

@return string
Get a unique anchor name