mirror of
https://github.com/AzuraCast/AzuraCast.git
synced 2024-06-15 05:36:37 +00:00
38 lines
924 B
PHP
Executable File
38 lines
924 B
PHP
Executable File
<?php
|
|
|
|
namespace DF\Form\Decorator;
|
|
|
|
class SpanFormErrors extends \Zend_Form_Decorator_Abstract
|
|
{
|
|
/**
|
|
* Render errors
|
|
*
|
|
* @param string $content
|
|
* @return string
|
|
*/
|
|
public function render($content)
|
|
{
|
|
$element = $this->getElement();
|
|
$view = $element->getView();
|
|
if (null === $view) {
|
|
return $content;
|
|
}
|
|
|
|
$errors = $element->getMessages();
|
|
if (empty($errors)) {
|
|
return $content;
|
|
}
|
|
|
|
$separator = $this->getSeparator();
|
|
$placement = $this->getPlacement();
|
|
$errors = $view->spanFormErrors($errors, $this->getOptions());
|
|
|
|
switch ($placement) {
|
|
case self::APPEND:
|
|
return $content . $separator . $errors;
|
|
case self::PREPEND:
|
|
return $errors . $separator . $content;
|
|
}
|
|
}
|
|
}
|