function assetTreeConvertToOneRegionTemplate(aohs\AssetOperationHandlerService $service, p\Child $child, $params = NULL, &$results = NULL) { if (!isset($params['site-storage']) || !isset($params['global-link-script']) || !isset($params['page-title']) || !isset($params['search-form']) || !isset($params['content-type'])) { throw new \Exception("Some of the parameters are missing."); } $type = $child->getType(); if ($type != a\Page::TYPE) { return; } // skip entire folder if (strpos($child->getPathPath(), "_extra/") !== false) { return; } if (strpos($child->getPathPath(), "_cascade/") !== false) { return; } $site_storage_block = $params['site-storage']; $global_link_script_block = $params['global-link-script']; $page_title_block = $params['page-title']; $search_form_block = $params['search-form']; $one_region_ct = $params['content-type']; $page = $service->getAsset($child->getType(), $child->getId()); try { $page->setContentType($one_region_ct); $cur_sd = $page->getStructuredData(); $new_sd = $cur_sd->mapData(); $page->setStructuredData($new_sd); $page->setBlock("site-config-group;site-storage", $site_storage_block)->setBlock("site-config-group;global-link-script", $global_link_script_block)->setBlock("site-config-group;page-title", $page_title_block)->setBlock("site-config-group;search-form", $search_form_block)->edit(); } catch (\Exception $e) { echo $page->getId(), BR; throw $e; } }