Zend Framework Source Code Snippets

AnyMarkup Decorator

<?php
class My_Decorator_AnyMarkup extends Zend_Form_Decorator_Abstract {

    public function render($content) {
        $placement = $this->getPlacement();
        $separator = $this->getSeparator();
        switch ($placement) {
            case self::PREPEND:
                return $this->_options['markup'] . $separator . $content;
            case self::APPEND:
            default:
                return $content . $separator . $this->_options['markup'];
        }
    }

}
?>

Comments

You must login before commenting on a snippet. If you do not have an account, please register.

With the AnyMarkup decorator you can place arbitrary markup before or after other output.

Just put the key 'markup' in the decorator options somewhere and assign it some (valid) markup.

Use multiple instances of the decorator to wrap your content withy any markup. See http://devzone.zend.com/article/3450-Decorators-with-Zend_Form for a reference on using multiple instances of a decorator.

Created:
chiborg chiborg
7 months ago
Edited:
chiborg chiborg
7 months ago
Revision Id:
116
Edit Message:
Initial Release
ZF Version
1.8.3
Tags:
form decorator markup html
Comments:
0
Points:
1 (1 votes)

History

r116

Initial Release

chiborg chiborg
7 months ago
diff
r115

Initial Release

chiborg chiborg
7 months ago
diff
r114

Initial Release

chiborg chiborg
7 months ago