public function testGetOptions() { $this->rawLayout->add('root', null, 'root', ['root_option1' => 'val1']); $this->rawLayout->setProperty('root', RawLayout::RESOLVED_OPTIONS, ['root_option1' => 'val1', 'id' => 'root']); $this->rawLayout->add('header', 'root', 'header', ['header_option1' => 'val1']); $this->rawLayout->setProperty('header', RawLayout::RESOLVED_OPTIONS, ['header_option1' => 'val1', 'id' => 'header']); $this->block->initialize('header'); $this->assertEquals(['header_option1' => 'val1', 'id' => 'header'], $this->block->getOptions()); $this->assertEquals(['root_option1' => 'val1', 'id' => 'root'], $this->block->getParent()->getOptions()); }
/** * Builds the block * * @param string $id */ 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); // resolve options $resolvedOptions = $this->optionsResolver->resolveOptions($blockType, $options); $this->rawLayout->setProperty($id, RawLayout::RESOLVED_OPTIONS, $resolvedOptions); // point the block builder state to the current block $this->blockBuilder->initialize($id); // iterate from parent to current foreach ($types as $type) { $type->buildBlock($this->blockBuilder, $resolvedOptions); $this->registry->buildBlock($type->getName(), $this->blockBuilder, $resolvedOptions); } }
/** * @dataProvider emptyStringDataProvider * * @expectedException \Oro\Component\Layout\Exception\InvalidArgumentException * @expectedExceptionMessage The item id must not be empty. */ public function testSetPropertyWithEmptyId($id) { $this->rawLayout->setProperty($id, 'some_property', 123); }
/** * {@inheritdoc} */ public function removeOption($id, $optionName) { $options = $this->rawLayout->getProperty($id, RawLayout::OPTIONS); $this->propertyAccessor->remove($options, $this->getPropertyPath($optionName)); $this->rawLayout->setProperty($id, RawLayout::OPTIONS, $options); }