public function getAreaRelationName()
    {
        // Allow repeated calls to return from internal cache
        if (isset($this->cacheData['area_relation_name'])) {
            return $this->cacheData['area_relation_name'];
        }

        $page = $this->getPage();

        $result = 'ElementalArea';

        if ($page) {
            $has_one = $page->config()->get('has_one');
            $area = $this->Parent();

            foreach ($has_one as $relationName => $relationClass) {
                if ($page instanceof BaseElement && $relationName === 'Parent') {
                    continue;
                }
                if ($relationClass === $area->ClassName && $page->{$relationName}()->ID === $area->ID) {
                    $result = $relationName;
                    break;
                }
            }
        }

        $this->setAreaRelationNameCache($result);

        return $result;
    }
public function getAreaRelationName()
    {
        // Allow repeated calls to return from internal cache
        if (isset($this->cacheData['area_relation_name'])) {
            return $this->cacheData['area_relation_name'];
        }

        $page = $this->getPage();

        $result = 'ElementalArea';

        if ($page) {
            $has_one = $page->config()->get('has_one');
            $area = $this->Parent();

            foreach ($has_one as $relationName => $relationClass) {
                if ($page instanceof BaseElement && $relationName === 'Parent') {
                    continue;
                }
                if ($relationClass === $area->ClassName && $page->{$relationName}()->ID === $area->ID) {
                    $result = $relationName;
                    break;
                }
            }
        }

        $this->setAreaRelationNameCache($result);

        return $result;
    }
public function getAreaRelationName ( ) { // Allow repeated calls to return from internal cache if ( isset ( $ this -> cacheData [ 'area_relation_name' ] ) ) { return $ this -> cacheData [ 'area_relation_name' ] ; } $ page = $ this -> getPage ( ) ; $ result = 'ElementalArea' ; if ( $ page ) { $ has_one = $ page -> config ( ) -> get ( 'has_one' ) ; $ area = $ this -> Parent ( ) ; foreach ( $ has_one as $ relationName => $ relationClass ) { if ( $ page instanceof BaseElement && $ relationName === 'Parent' ) { continue ; } if ( $ relationClass === $ area -> ClassName && $ page -> { $ relationName } ( ) -> ID === $ area -> ID ) { $ result = $ relationName ; break ; } } } $ this -> setAreaRelationNameCache ( $ result ) ; return $ result ; }
Retrieve a elemental area relation for creating cms links

@return int|string The name of a valid elemental area relation
@throws \Psr\Container\NotFoundExceptionInterface
@throws \SilverStripe\ORM\ValidationException
Retrieve a elemental area relation for creating cms links