@param LayoutBlock $object

@return mixed|void
767791
public function preRemove($object)
    {
        if ($classType = $object->getClassType()) {
            $contentObject = $this->getModelManager()->find($classType, $object->getObjectId());
            if ($contentObject) {
                $this->getModelManager()->delete($contentObject);
            }
        }

        $this->autoPageDraft($object->getPage());
    }
816225
public function generateBlockStorage($object, $isPrimaryKey = false)
    {
        $vendorSpecific = $object->getVendorInfoForType('oracle');
        if ($vendorSpecific->isEmpty()) {
            return '';
        }

        if ($isPrimaryKey) {
            $physicalParameters = "
USING INDEX
";
            $prefix = "PK";
        } else {
            $physicalParameters = "\n";
            $prefix = "";
        }

        if ($vendorSpecific->hasParameter($prefix . 'PCTFree')) {
            $physicalParameters .= "PCTFREE " . $vendorSpecific->getParameter($prefix . 'PCTFree') . "
";
        }
        if ($vendorSpecific->hasParameter($prefix . 'InitTrans')) {
            $physicalParameters .= "INITRANS " . $vendorSpecific->getParameter($prefix . 'InitTrans') . "
";
        }
        if ($vendorSpecific->hasParameter($prefix . 'MinExtents') || $vendorSpecific->hasParameter($prefix . 'MaxExtents') || $vendorSpecific->hasParameter($prefix . 'PCTIncrease')) {
            $physicalParameters .= "STORAGE
(
";
            if ($vendorSpecific->hasParameter($prefix . 'MinExtents')) {
                $physicalParameters .= "	MINEXTENTS " . $vendorSpecific->getParameter($prefix . 'MinExtents') . "
";
            }
            if ($vendorSpecific->hasParameter($prefix . 'MaxExtents')) {
                $physicalParameters .= "	MAXEXTENTS " . $vendorSpecific->getParameter($prefix . 'MaxExtents') . "
";
            }
            if ($vendorSpecific->hasParameter($prefix . 'PCTIncrease')) {
                $physicalParameters .= "	PCTINCREASE " . $vendorSpecific->getParameter($prefix . 'PCTIncrease') . "
";
            }
            $physicalParameters .= ")
";
        }
        if ($vendorSpecific->hasParameter($prefix . 'Tablespace')) {
            $physicalParameters .= "TABLESPACE " . $vendorSpecific->getParameter($prefix . 'Tablespace');
        }

        return $physicalParameters;
    }
864593
public function setLayout($template) {
		$layout = $this->getTemplatePathname($template);
		if(!is_file($layout)) {
			throw new \RuntimeException("Layout file `$template` does not exist.");
		} else {
			$this->layout = $template;
		}
	}
814956
protected function _setBlock($block)
    {
        if ($block !== null && !($block instanceof BlockInterface)) {
            throw $this->_createInvalidArgumentException(
                $this->__('Invalid block'),
                null,
                null,
                $block
            );
        }

        $this->block = $block;
    }
386234
protected function doFilter($object): void
    {
        $clearAll = false;
        $id = spl_object_hash($object);
        array_splice($this->toFilter, array_search($id, $this->toFilter, true), 1);

        if (!$this->isViewGranted($object)) {
            $clearAll = true;
        }

        $ref = new \ReflectionClass($object);

        foreach ($ref->getProperties() as $property) {
            $property->setAccessible(true);
            $fieldVote = new FieldVote($object, $property->getName());
            $value = $property->getValue($object);

            if ($this->isFilterViewGranted($fieldVote, $value, $clearAll)) {
                $value = $this->ofe->filterValue($value);
                $property->setValue($object, $value);
            }
        }
    }
391148
public function combine(Block $block)
    {
        $this->setBlockData($block->blockData, false);
        $this->setGlobalData($block->globalData, false);
        $this->addTemplates($block->templates);
        $this->addRepeaterBlocks($block->inRepeaterBlocks);
        $this->addRepeaterChildBlocks($block->repeaterChildBlocks);
        $this->addCategoryTemplates($block->inCategoryTemplates);
        $this->addSpecifiedPageIds($block->specifiedPageIds);
    }
436355
public function prePersist($object)
    {
        /** @var ContentInterface $contentObject */
        if ($contentObject = $object->getContent()) {
            try {
                $this->getModelManager()->create($contentObject);
                $object->setObjectId($contentObject->getId());
                $this->autoPageDraft($object->getPage());
            } catch (ModelManagerException $e) {
                throw new ModelManagerException($this->trans('Cannot create content, object is invalid', [], 'validators'));
            }
        }
    }
102805
public function loadLayoutBlocksData(Layout $layout): array
    {
        $query = $this->getBlockSelectQuery();
        $query->where(
            $query->expr()->eq('b.layout_id', ':layout_id')
        )
        ->setParameter('layout_id', $layout->id, Type::INTEGER);

        $this->applyStatusCondition($query, $layout->status, 'b.status');

        return $query->execute()->fetchAll(PDO::FETCH_ASSOC);
    }
922482
public function layoutAction(Request $request)
    {
        $block = $this->findBlockByRequest($request);

        $data = $request->request->get('data', []);

        try {
            $this->getEditor()->getLayoutAdapter()->updateBlockLayout($block, $data);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

        $this->validate($block);
        $this->persist($block);

        $data = [
            'blocks' => [$this->getViewBuilder()->buildBlock($block)],
        ];

        return $this->buildResponse($data, self::SERIALIZE_LAYOUT);
    }
932777
protected function _collectTags($object)
    {
        if ($object instanceof Mage_Cms_Model_Block) {
            return self::TAG_PREFIX . $object->getIdentifier();
        }
        return self::TAG_PREFIX . $object->getId();
    }
402080
protected function renderCommand(BlockLayout $layout, Command $command)
    {
        $description = $command->getConfig()->getDescription();
        $name = '<c1>'.$command->getName().'</c1>';

        $layout->add(new LabeledParagraph($name, $description));
    }
171738
public function prepare(Template $template): void
    {
        $formLayout = $this->layoutManager->getDefaultLayout();

        if ($formLayout instanceof HorizontalFormLayout) {
            $template->labelColClass  = $formLayout->getLabelColumnClass();
            $template->colClass       = $formLayout->getColumnClass();
            $template->colOffsetClass = $formLayout->getColumnClass(true);
            $template->rowClass       = $formLayout->getRowClass();
            $template->isHorizontal   = true;
        } else {
            $template->labelColClass  = null;
            $template->colClass       = null;
            $template->colOffsetClass = null;
            $template->rowClass       = null;
            $template->isHorizontal   = false;
        }

        $template->formLayout  = $formLayout;
        $template->buttonClass = $this->getButtonClass();
    }
969211
public function setLayout($layout, $layoutModule = null)
    {
        $this->layout = $layout;
        $this->layoutModule = $layoutModule;

        return $this;
    }
19547
public function resetContent(PageInterface $page, LayoutBlock $layoutBlock, \JMS\Serializer\SerializerInterface $serializer)
    {
	    if ($contentObject = $layoutBlock->getSnapshotContent()) {
		    $contentObject = $serializer->deserialize($contentObject, $layoutBlock->getClassType(), 'json');



		    try {
			    $contentObject = $this->_em->merge($contentObject);
			    $reflection = new \ReflectionClass($contentObject);
			    foreach ($reflection->getProperties() as $property) {
				    $method = sprintf('get%s', ucfirst($property->getName()));
				    if ($reflection->hasMethod($method) && $var = $contentObject->{$method}()) {
					    if ($var instanceof ArrayCollection) {
						    foreach ($var as $key =>  $v) {
							    $v = $this->_em->merge($v);

							    $var->set($key, $v);
						    }
						    $method = sprintf('set%s', ucfirst($property->getName()));
						    $contentObject->{$method}($var);
					    }

					    if(is_object($var) && $this->_em->getMetadataFactory()->hasMetadataFor(get_class($var))){
						    $var = $this->_em->merge($var);

						    $method = sprintf('set%s', ucfirst($property->getName()));
						    $contentObject->{$method}($var);
					    }
				    }
			    }

			    $this->_em->persist($contentObject);
			    $this->_em->flush($contentObject);

		    } catch (EntityNotFoundException $e) {
			    $classType = $layoutBlock->getClassType();
			    $newContentObject = clone $contentObject;
			    $reflection = new \ReflectionClass($contentObject);
			    foreach ($reflection->getProperties() as $property) {
				    $method = sprintf('get%s', ucfirst($property->getName()));
				    if ($reflection->hasMethod($method) && $var = $contentObject->{$method}()) {
					    if ($var instanceof ArrayCollection) {
						    foreach ($var as $key =>  $v) {
							    $v = $this->_em->merge($v);

							    $var->set($key, $v);
						    }
						    $method = sprintf('set%s', ucfirst($property->getName()));
						    $newContentObject->{$method}($var);
					    }

					    if(is_object($var) && $this->_em->getMetadataFactory()->hasMetadataFor(get_class($var))){
						    $var = $this->_em->merge($var);

						    $method = sprintf('set%s', ucfirst($property->getName()));
						    $newContentObject->{$method}($var);
					    }

				    }
			    }
			    $this->_em->persist($newContentObject);
			    $this->_em->flush($newContentObject);


			    $layoutBlock->setObjectId($newContentObject->getId());
		    }

	    }

	    $layoutBlock->setPage($page);

	    $this->_em->persist($layoutBlock);

	    $this->_em->flush($layoutBlock);

	    return $layoutBlock;
    }
515125
public function remove($object)
    {
        if ($object instanceof NodeInterface) {
            $object = $object->getNodeData();
        }
        if ($this->addedNodes->contains($object)) {
            $this->addedNodes->detach($object);
        }
        if (!$this->removedNodes->contains($object)) {
            $this->removedNodes->attach($object);
        }
        parent::remove($object);
    }
299564
public function buildBlock(Model\BlockInterface $block)
    {
        $editable = $this->editor->isEnabled();

        $view = new BlockView();
        $attributes = $view->getAttributes()->addClass('cms-block');

        if ($editable) {
            $row = $block->getRow();

            $attributes
                ->setId('cms-block-' . $block->getId())
                ->setData([
                    'id'       => $block->getId(),
                    'type'     => $block->getType(),
                    'position' => $block->getPosition(),
                    'actions'  => [
                        'add'         => !is_null($row),
                        'edit'        => false,
                        'layout'      => true,
                        'change_type' => !$block->isNamed(),
                        'move_left'   => !$block->isFirst(),
                        'move_right'  => !$block->isLast(),
                        'move_up'     => !$block->isAlone() && !$row->isFirst(),
                        'move_down'   => !$block->isAlone() && !$row->isLast(),
                        'remove'      => !$block->isAlone(),
                    ],
                ]);
        }

        $adapter = $this->editor->getLayoutAdapter();

        // Layout
        $adapter->buildBlock($block, $view);

        // Plugin
        $this->editor
            ->getBlockPlugin($block->getType())
            ->render($block, $view, $adapter, [
                'editable' => $editable,
            ]);

        // Set widgets positions
        /*$p = 0;
        foreach ($view->widgets as $widgetView) {
            $widgetView->getAttributes()->setData('position', $p);
            $p++;
        }*/

        return $view;
    }
1075613
public function removeItem(LayoutItem $item)
    {
        $itemId = spl_object_hash($item);

        foreach ($this as $myItem) {
            if ($itemId == spl_object_hash($myItem)) {
                return $this->remove($myItem->getRow(), $myItem->getColumn());
            }
        }

        return $this;
    }