Skip to content

Commit

Permalink
Fix: FormElement view helper causes endless loop if called from view …
Browse files Browse the repository at this point in the history
…partial.
  • Loading branch information
TiSiE committed Jan 20, 2017
1 parent c742607 commit f7afa8d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion module/Core/src/Core/Entity/Tree/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function setValue($value)
if (!$this->getName()) {
throw new \InvalidArgumentException('Value must not be empty.');
}
$value = strtolower(str_replace(' ', '-', $this->getName()));
$value = strtolower(str_replace([' ', '-'], '_', $this->getName()));
}

$this->value = (string) $value;
Expand Down
4 changes: 2 additions & 2 deletions module/Core/src/Core/Form/View/Helper/FormElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ class FormElement extends ZendFormElement
*
* @return string
*/
public function render(ElementInterface $element)
public function render(ElementInterface $element, $ignoreViewPartial = false)
{
$renderer = $this->getView();
if (!method_exists($renderer, 'plugin')) {
// Bail early if renderer is not pluggable
return '';
}

if ($element instanceof ViewPartialProviderInterface) {
if ($element instanceof ViewPartialProviderInterface && !$ignoreViewPartial) {
$partial = $element->getViewPartial();
return $renderer->partial($partial, ['element' => $element]);
}
Expand Down
2 changes: 1 addition & 1 deletion module/Core/src/Core/Form/View/Helper/FormRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function render(ElementInterface $element, $ignoreViewPartial = false)
$element->setAttribute('class', $element->getAttribute('class').' form-control ');
}

$elementString = $elementHelper->render($element);
$elementString = $elementHelper->render($element, $ignoreViewPartial);
$desc = $element->getOption('description', false);
if ($desc && $this->layout != Form::LAYOUT_BARE) {
if (null !== ($translator = $this->getTranslator())) {
Expand Down

0 comments on commit f7afa8d

Please sign in to comment.