public function duplicateToSubsite($subsiteID = null, $includeChildren = false)
    {
        $clone = $this->owner->duplicateToSubsitePrep($subsiteID, $includeChildren);
        $clone->invokeWithExtensions('onBeforeDuplicateToSubsite', $this->owner);

        if (!$includeChildren) {
            // Write the new page if "include children" is false, because it is written by default when it's true.
            $clone->write();
        }
        // Deprecated: manually duplicate any configured relationships
        $clone->duplicateSubsiteRelations($this->owner);

        $clone->invokeWithExtensions('onAfterDuplicateToSubsite', $this->owner);

        return $clone;
    }
public function duplicateToSubsite($subsiteID = null, $includeChildren = false)
    {
        $clone = $this->owner->duplicateToSubsitePrep($subsiteID, $includeChildren);
        $clone->invokeWithExtensions('onBeforeDuplicateToSubsite', $this->owner);

        if (!$includeChildren) {
            // Write the new page if "include children" is false, because it is written by default when it's true.
            $clone->write();
        }
        // Deprecated: manually duplicate any configured relationships
        $clone->duplicateSubsiteRelations($this->owner);

        $clone->invokeWithExtensions('onAfterDuplicateToSubsite', $this->owner);

        return $clone;
    }
public function duplicateToSubsite ( $ subsiteID = null , $ includeChildren = false ) { $ clone = $ this -> owner -> duplicateToSubsitePrep ( $ subsiteID , $ includeChildren ) ; $ clone -> invokeWithExtensions ( 'onBeforeDuplicateToSubsite' , $ this -> owner ) ; if ( ! $ includeChildren ) { // Write the new page if "include children" is false, because it is written by default when it's true. $ clone -> write ( ) ; } // Deprecated: manually duplicate any configured relationships $ clone -> duplicateSubsiteRelations ( $ this -> owner ) ; $ clone -> invokeWithExtensions ( 'onAfterDuplicateToSubsite' , $ this -> owner ) ; return $ clone ; }
Create a duplicate of this page and save it to another subsite

@param Subsite|int $subsiteID   The Subsite to copy to, or its ID
@param boolean $includeChildren Whether to duplicate child pages too
@return SiteTree                The duplicated page
Create a duplicate of this page and save it to another subsite