public function duplicate($doWrite = true)
    {
        $clonedNode = parent::duplicate($doWrite);

        if ($this->Options()) {
            foreach ($this->Options() as $field) {
                $newField           = $field->duplicate();
                $newField->ParentID = $clonedNode->ID;
                $newField->write();
            }
        }

        return $clonedNode;
    }
public function duplicate($doWrite = true)
    {
        $clonedNode = parent::duplicate($doWrite);

        if ($this->Options()) {
            foreach ($this->Options() as $field) {
                $newField           = $field->duplicate();
                $newField->ParentID = $clonedNode->ID;
                $newField->write();
            }
        }

        return $clonedNode;
    }
public function duplicate ( $ doWrite = true ) { $ clonedNode = parent :: duplicate ( $ doWrite ) ; if ( $ this -> Options ( ) ) { foreach ( $ this -> Options ( ) as $ field ) { $ newField = $ field -> duplicate ( ) ; $ newField -> ParentID = $ clonedNode -> ID ; $ newField -> write ( ) ; } } return $ clonedNode ; }
Duplicate a pages content. We need to make sure all the fields attached
to that page go with it.

@param bool $doWrite

@return DataObject
Duplicate a pages content . We need to make sure all the fields attached to that page go with it .