src/TwbBundle/Form/View/Helper/TwbBundleFormErrors.php
public function render(FormInterface $oForm, $sMessage, $bDismissable = false)
    {
        $errorHtml = sprintf($this->messageOpenFormat, $sMessage);

        $sMessagesArray = array();

        foreach ($oForm->getMessages() as $fieldName => $sMessages) {
            foreach ($sMessages as $sMessage) {
                if ($oForm->get($fieldName)->getAttribute('id')) {
                    $sMessagesArray[] = sprintf(
                        '<a href="#%s">%s</a>',
                        $oForm->get($fieldName)->getAttribute('id'),
                        $oForm->get($fieldName)->getLabel() . ': ' . $sMessage
                    );
                } else {
                    $sMessagesArray[] = $oForm->get($fieldName)->getLabel() . ': ' . $sMessage;
                }
            }
        }

        return $this->dangerAlert(
            $errorHtml .
            implode($this->messageSeparatorString, $sMessagesArray) .
            $this->messageCloseString,
            $bDismissable
        );
    }
public function render(FormInterface $oForm, $sMessage, $bDismissable = false)
    {
        $errorHtml = sprintf($this->messageOpenFormat, $sMessage);

        $sMessagesArray = array();

        foreach ($oForm->getMessages() as $fieldName => $sMessages) {
            foreach ($sMessages as $sMessage) {
                if ($oForm->get($fieldName)->getAttribute('id')) {
                    $sMessagesArray[] = sprintf(
                        '<a href="#%s">%s</a>',
                        $oForm->get($fieldName)->getAttribute('id'),
                        $oForm->get($fieldName)->getLabel() . ': ' . $sMessage
                    );
                } else {
                    $sMessagesArray[] = $oForm->get($fieldName)->getLabel() . ': ' . $sMessage;
                }
            }
        }

        return $this->dangerAlert(
            $errorHtml .
            implode($this->messageSeparatorString, $sMessagesArray) .
            $this->messageCloseString,
            $bDismissable
        );
    }
public function render ( FormInterface $ oForm , $ sMessage , $ bDismissable = false ) { $ errorHtml = sprintf ( $ this -> messageOpenFormat , $ sMessage ) ; $ sMessagesArray = array ( ) ; foreach ( $ oForm -> getMessages ( ) as $ fieldName => $ sMessages ) { foreach ( $ sMessages as $ sMessage ) { if ( $ oForm -> get ( $ fieldName ) -> getAttribute ( 'id' ) ) { $ sMessagesArray [ ] = sprintf ( '<a href="#%s">%s</a>' , $ oForm -> get ( $ fieldName ) -> getAttribute ( 'id' ) , $ oForm -> get ( $ fieldName ) -> getLabel ( ) . ': ' . $ sMessage ) ; } else { $ sMessagesArray [ ] = $ oForm -> get ( $ fieldName ) -> getLabel ( ) . ': ' . $ sMessage ; } } } return $ this -> dangerAlert ( $ errorHtml . implode ( $ this -> messageSeparatorString , $ sMessagesArray ) . $ this -> messageCloseString , $ bDismissable ) ; }
Renders the error messages.
@param \Zend\Form\FormInterface $oForm
@return string
Renders the error messages .