Builds the block

@param string $id
321523
protected function buildBlock($id)
    {
        $blockType = $this->rawLayout->getProperty($id, RawLayout::BLOCK_TYPE, true);
        $options   = $this->rawLayout->getProperty($id, RawLayout::OPTIONS, true);
        $types     = $this->typeHelper->getTypes($blockType);

        $this->setBlockResolvedOptions($id, $blockType, $options, $types);
    }
1270116
public function sendBlock($id, $data, $name = null)
    {
        $this->output("id: {$id}\n");
        if (strlen($name) && $name !== null) {
            $this->output("event: {$name}\n");
        }
        $this->output($this->wrapData($data)."\n\n");
        flush();
    }
108939
public function setId($id)
    {
        $id = $this->buildId($id);

        if ($this->isRelation($id)) {
            $relations = explode('.', $id);

            $lastElement = array_pop($relations);

            if (!$this->keepOriginalID) {
                $id = $lastElement;
            }

            $this->relations = $relations;
        }

        $this->id = $id;

        return $this;
    }
101891
protected function buildBlocks($rootId)
    {
        // build the root block
        if (!$this->rawLayout->hasProperty($rootId, RawLayout::RESOLVED_OPTIONS, true)) {
            $this->buildBlock($rootId);
        }

        // build child blocks
        $iterator = $this->rawLayout->getHierarchyIterator($rootId);
        foreach ($iterator as $id) {
            if (!$this->rawLayout->has($id) || $this->rawLayout->hasProperty($id, RawLayout::RESOLVED_OPTIONS, true)) {
                // the block is already built
                continue;
            }
            if (!$this->isContainerBlock($iterator->getParent())) {
                $blockType = $this->rawLayout->getProperty($iterator->getParent(), RawLayout::BLOCK_TYPE, true);

                throw new Exception\LogicException(
                    sprintf(
                        'The "%s" item cannot be added as a child to "%s" item (block type: %s) '
                        . 'because only container blocks can have children.',
                        $id,
                        $iterator->getParent(),
                        $blockType instanceof BlockTypeInterface ? $blockType->getName() : $blockType
                    )
                );
            }
            $this->buildBlock($id);
        }

        // apply layout changes were made by built blocks and build newly added blocks
        $this->layoutManipulator->applyChanges($this->context);
        if ($this->layoutManipulator->getNumberOfAddedItems() !== 0) {
            $this->buildBlocks($rootId);
        }
    }
108811
public function remove($id)
    {
        $this->_checkAndBuildStructure();
        $res = $this->_query("SELECT COUNT(*) AS nbr FROM cache WHERE id='$id'");
        $result1 = @sqlite_fetch_single($res);
        $result2 = $this->_query("DELETE FROM cache WHERE id='$id'");
        $result3 = $this->_query("DELETE FROM tag WHERE id='$id'");
        $this->_automaticVacuum();
        return ($result1 && $result2 && $result3);
    }
1129449
public function show($id)
    {
        $projectConstructions = $this->client->get(
            sprintf('templates/%d/project_constructions/%d.json', $this->parent, $id)
        );

        return $this->response($projectConstructions);
    }
218840
public function actionDownloadFile($id): void
	{
		$this->sendResponse($this->app->logs->downloadFile($id));
	}
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;
    }
191223
public function isBlockedBy($id): bool
    {
        if (is_array($id)) {
            return count($id) === $this->blockerUsers()->whereIn('blocker_id', $id)->count();
        }

        return $this->blockerUsers()->where('blocker_id', $id)->exists();
    }
169923
public function handleDelete($id): void
	{
		if ($this->isAjax()) {
			$this->app->logs->delete($id);
			$grid = $this['logsList'];
			$grid->setDataSource($this->app->logs->logs);
			$grid->reload();
		} else {
			$this->terminate();
		}
	}
36171
public function setId($id)
    {
        if (($content = $this->getContent()) instanceof FormInterface) {
            $content->setId($id);
        }

        return $this;
    }
819246
protected function setIds($id)
    {
        if ($id) {
            $this->props = $this->mergeProps(array(
                $this->props,
                array(
                    'attribsContainer' => array(
                        'id' => $id.'_container',
                    ),
                    'attribs' => array(
                        'id' => $id,
                    ),
                    'attribsLabel' => array(
                        'for' => $id,
                    ),
                    'attribsHelpBlock' => array(
                        'id' => $id.'_help_block',
                    ),
                ),
            ));
        }
    }
166710
public function setId($id)
    {
        if ($this->id) {
            return;
        }
        if (strlen($id) >= 20) {
            $this->id = $id;

            return;
        }
        list($a, $b) = explode(' ', microtime());
        $this->id = preg_replace("/[^\d]/", '', $b.$a.$id);
    }
1166631
public function removeBlockAction($id)
    {
        /** @var BlockManager $manager */
        $manager  = $this->get('opifer.content.block_manager');
        $response = new JsonResponse;

        try {
            $block = $manager->find($id, true);
            $manager->remove($block, true);
            $response->setData(['state' => 'removed']);
        } catch (\Exception $e) {
            $response->setStatusCode(500);
            $response->setData(['error' => $e->getMessage()]);
        }

        return $response;
    }
882015
public function buildId($id)
    {
        $parts = explode(' ', $id, 2);
        if (count($parts) === 2) {
            return $this->buildIdWithAlias($parts[0], $parts[1]);
        }

        return $this->wrap($id);
    }
768329
protected function buildBlockView($id, BlockView $parentView = null)
    {
        $blockType       = $this->rawLayout->getProperty($id, RawLayout::BLOCK_TYPE, true);
        $resolvedOptions = $this->rawLayout->getProperty($id, RawLayout::RESOLVED_OPTIONS, true);
        $types           = $this->typeHelper->getTypes($blockType);
        $view            = new BlockView($parentView);

        if (is_null($resolvedOptions)) { // Try to resolve options again to render block
            $options  = $this->rawLayout->getProperty($id, RawLayout::OPTIONS, true);
            $resolvedOptions = $this->setBlockResolvedOptions($id, $blockType, $options, $types);
        }

        // point the block view state to the current block
        $this->block->initialize($id);
        // build the view
        foreach ($types as $type) {
            $type->buildView($view, $this->block, $resolvedOptions);
            $this->registry->buildView($type->getName(), $view, $this->block, $resolvedOptions);
        }

        array_walk_recursive(
            $view->vars,
            function (&$var) {
                if ($var instanceof Options) {
                    $var = $var->toArray();
                }
            }
        );

        return $view;
    }
353111
public function setInvisible(int $id): void
    {
        $sourceNodeData = $this->locationGateway->getBasicNodeData($id);

        $this->locationGateway->setNodeWithChildrenInvisible($sourceNodeData['path_string']);
    }