public function allowShare(BlockInterface $block) { return !$block->isShared(); }
/** * Publishes a block version * * @param BlockOwnerInterface $block * @param boolean|integer $version */ public function publish(BlockInterface $block) { if (!$block instanceof BlockOwnerInterface && !$block->isShared()) { throw new \Exception('Can only publish blocks of type BlockOwner or shared'); } $this->killLoggableListener(); $this->killSoftDeletableListener(); $owned = $this->findByOwner($block); $version = $this->getNewVersion($block); foreach ($owned as $descendant) { $this->revertSingle($descendant, $version); $descendant->setPublish(true); $descendant->setVersion($version); $descendant->setRootVersion($version); $this->save($descendant); } $this->revertSingle($block, $version); $block->setPublish(true); $block->setVersion($version); $block->setRootVersion($version); $this->save($block); }