Ejemplo n.º 1
0
 public function allowShare(BlockInterface $block)
 {
     return !$block->isShared();
 }
Ejemplo n.º 2
0
 /**
  * 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);
 }