copyFolders
Attention! We strongly recommend first to learn more about Sites module REST documentation to understand how the module functions (with REST available in Bitrix24 Self-hosted editions). View this documentation as useful source when working with Bitrix24 Self-hosted editions and when you want to learn more about API.
Site::copyFolders( $fromSite, $toSite, &$folderMap );
Method copies all folders from one site to another, without pages.
Parameters
Parameters | Description | Available from version |
---|---|---|
$fromSite | Site ID from which to copy folders. Require site read access permissions. | |
$toSite | Site ID to copy folders. Requires write access permissions. | |
&$folderMap | Linked array. After executing the method, the array will contain legacy and new folder links. |
Example
if (\Bitrix\Main\Loader::includeModule('landing')) { $map = []; $res = \Bitrix\Landing\Site::copyFolders(2076, 2330, $map); if ($res->isSuccess()) { echo 'Folders copied'; print_r($map); } else { foreach ($res->getErrors() as $error) { echo $error->getMessage() . '<br/>'; } } }
© «Bitrix24», 2001-2024