Zend Framework Source Code Snippets

AnyMarkup Decorator

Bookmark and Share
1
2
3
4
56
7
8
9
1011
12
13
14
1516
17
<?php
class Describe_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.

Snippet description

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.

Snippet details

Created:
chiborg chiborg
5 years ago
Edited:
chiborg chiborg
5 years ago
Revision Id:
114
Edit Message:
Initial Release
ZF Version
1.8.3
Tags:
form decorator markup html
Comments:
0
Views:
8465
Points:
2 (2 votes)

History

r116

Initial Release

chiborg chiborg
5 years ago
diff
r115

Initial Release

chiborg chiborg
5 years ago
diff
r114

Initial Release

chiborg chiborg
5 years ago