public function onBeforeWrite()
    {
        parent::onBeforeWrite();

        if (!$this->supportsElemental()) {
            return;
        }

        $elementalAreaRelations = $this->owner->getElementalRelations();

        $this->ensureElementalAreasExist($elementalAreaRelations);

        if (Config::inst()->get(self::class, 'clear_contentfield')) {
            $this->owner->Content = '';
        }
    }
public function onBeforeWrite()
    {
        parent::onBeforeWrite();

        if (!$this->supportsElemental()) {
            return;
        }

        $elementalAreaRelations = $this->owner->getElementalRelations();

        $this->ensureElementalAreasExist($elementalAreaRelations);

        if (Config::inst()->get(self::class, 'clear_contentfield')) {
            $this->owner->Content = '';
        }
    }
public function onBeforeWrite ( ) { parent :: onBeforeWrite ( ) ; if ( ! $ this -> supportsElemental ( ) ) { return ; } $ elementalAreaRelations = $ this -> owner -> getElementalRelations ( ) ; $ this -> ensureElementalAreasExist ( $ elementalAreaRelations ) ; if ( Config :: inst ( ) -> get ( self :: class , 'clear_contentfield' ) ) { $ this -> owner -> Content = '' ; } }
Make sure there is always an ElementalArea for adding Elements
Make sure there is always an ElementalArea for adding Elements