Create page of PageType and customize blocks
Permalink 1 user found helpful
Hi,
I have a PageType which contains 2 blocks.
I want to create a page of that PageType and customize these 2 blocks but i don't want that these changes take effect on PageType
this is my code :
Is There a solution to create a copy of the block?
Thanks,
I have a PageType which contains 2 blocks.
I want to create a page of that PageType and customize these 2 blocks but i don't want that these changes take effect on PageType
this is my code :
$parent = Page::getByID($this->post('cParentID')); $ct = CollectionType::getByHandle('my_pagetype'); $data = array('cName' => $this->post('ctTitle'), 'cDescription' => $this->post('ctDescription')); $p = $parent->add($ct, $data); // Edit existing Page List Block $eb = $p->getBlocks('Main'); if (is_object($eb[0])) { $block = $eb[0]->getInstance(); $data = array(); $data['cParentID'] = $p->getCollectionID(); $data['num'] = $block->num; $data['cThis'] = $block->cThis; $data['ctID'] = $p->getCollectionTypeID(); $block->save($data); }
Is There a solution to create a copy of the block?
Thanks,