private function getPageLevelBlockFormat(Cascade $c, Page $p) { $map = array(); $config_set = $p->getConfigurationSet(); $config_names = $config_set->getPageConfigurationNames(); foreach ($config_names as $config_name) { $map[$config_name] = array(); $config = $config_set->getPageConfiguration($config_name); $block_format_map = $p->getBlockFormatMap($config); $map[$config_name][] = $block_format_map; } return $map; }
public function removePage(Page $page) { $id = $page->getId(); $temp = array(); foreach ($this->pages as $page) { if ($page->getId() != $id) { $temp[] = $page; } } $this->pages = $temp; return $this; }
public function setPage(a\Page $page = NULL) { // required if ($this->required && $page == NULL) { throw new e\EmptyValueException(S_SPAN . c\M::NULL_PAGE . E_SPAN); } if ($this->asset_type != c\T::PAGE) { throw new e\NodeException(S_SPAN . "The asset does not accept a page." . E_SPAN); } if (isset($page)) { $this->page_id = $page->getId(); $this->page_path = $page->getPath(); } else { $this->page_id = NULL; $this->page_path = NULL; } return $this; }
use cascade_ws_exception as e; try { // getting $service object through $cascade echo $cascade->getService() === $service ? "Same service object" : "Not the same", HR; // conversion between class objects and stdClass objects $type = a\Page::TYPE; $path = "test/velocity/test-calling-page"; $site = "cascade-admin"; $id_st = "c916b2778b7f08ee5823686aff125245"; // an stdClass object $id_stdClass = $service->createId($type, $id_st); u\DebugUtility::dump($id_stdClass); // Identifier, a Property object $identifier = new p\Identifier($id_stdClass); u\DebugUtility::dump($identifier); u\DebugUtility::dump($identifier->toStdClass()); // 3 ways to create an Asset object // first way, use $cascade $page1 = $cascade->getAsset($type, $path, $site); // second way, use use Child/Identifier and $service $page2 = $identifier->getAsset($service); // third way, use constructor $page3 = new a\Page($service, $id_stdClass); echo $page1->getId() === $page2->getId() ? "Same ID" : "Not the same", BR, $page2->getName() === $page3->getName() ? "Same name" : "Not the same", BR; // getting $service object through asset echo $page1->getService() === $service ? "Same service object" : "Not the same", HR; // stdClass object u\DebugUtility::dump($page1->getIdentifier()); } catch (\Exception $e) { echo S_PRE . $e . E_PRE; }