/** * @param ElementView $element * @param array $attributes * @param array $options * @return string */ public function renderElement(ElementView $element, $attributes = [], array $options = []) { $this->options->overrideBlocks($element, $options); $html = $this->renderBlock($element->block, ['element' => $element, 'attr' => array_merge($element->attributes, $attributes), 'value' => $element->value, 'options' => array_merge($element->options, $options), 'choices' => $element->choices]); $element->rendered = true; return $html; }
/** @test */ public function it_should_override_all_the_block_options_of_an_element() { $name = new Text('name'); $nameView = $name->buildView(); $options = ['block' => 'my_text_element', 'row_block' => 'my_row_block']; $this->options->overrideBlocks($nameView, $options); $this->assertEquals('my_text_element', $nameView->block); $this->assertEquals('my_row_block', $nameView->rowBlock); }