Zend_Form_Decorator_Label

Accepts the options:

  • separator: separator to use between label and content (defaults to PHP_EOL)
  • placement: whether to append or prepend label to content (defaults to prepend)
  • tag: if set, used to wrap the label in an additional HTML tag
  • tagClass: if tag option is set, used to add a class to the label wrapper
  • opt(ional)Prefix: a prefix to the label to use when the element is optional
  • opt(ional)Suffix: a suffix to the label to use when the element is optional
  • req(uired)Prefix: a prefix to the label to use when the element is required
  • req(uired)Suffix: a suffix to the label to use when the element is required

Any other options passed will be used as HTML attributes of the label tag.

category Zend
package Zend_Form
subpackage Decorator
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
version $Id$
inherited_from \Zend_Form_Decorator_Abstract

 Methods

Overloading

__call(string $method, array $args) : mixed

Currently overloads:

  • getOpt(ional)Prefix()
  • getOpt(ional)Suffix()
  • getReq(uired)Prefix()
  • getReq(uired)Suffix()
  • setOpt(ional)Prefix()
  • setOpt(ional)Suffix()
  • setReq(uired)Prefix()
  • setReq(uired)Suffix()

Parameters

$method

string

$args

array

Exceptions

\Zend_Form_Exception for unsupported methods

Returns

mixed

Constructor

__construct(array|\Zend_Config $options = null) : void
Inherited

Accept options during initialization.

inherited_from \Zend_Form_Decorator_Interface::__construct()

Parameters

$options

array\Zend_Config

Clear all options

clearOptions() : \Zend_Form_Decorator_Abstract
Inherited
inherited_from \Zend_Form_Decorator_Interface::clearOptions()

Returns

\Zend_Form_Decorator_Abstract

Get class with which to define label

getClass() : string

Appends either 'optional' or 'required' to class, depending on whether or not the element is required.

Returns

string

Retrieve current element

getElement() : \Zend_Form_Element | \Zend_Form
Inherited
inherited_from \Zend_Form_Decorator_Interface::getElement()

Returns

\Zend_Form_Element\Zend_Form

Retrieve element ID (used in 'for' attribute)

getId() : string

If none set in decorator, looks first for element 'id' attribute, and defaults to element name.

Returns

string

Get label to render

getLabel() : string

Returns

string

Get option

getOption(string $key) : mixed
Inherited
inherited_from \Zend_Form_Decorator_Interface::getOption()

Parameters

$key

string

Returns

mixed

Retrieve options

getOptions() : array
Inherited
inherited_from \Zend_Form_Decorator_Interface::getOptions()

Returns

array

Determine if label should append, prepend or implicit content

getPlacement() : string
inherited_from \Zend_Form_Decorator_Abstract::getPlacement()

Returns

string

Determine if decorator should append or prepend content

getPlacement() : string
Inherited

Returns

string

Retrieve separator to use between old and new content

getSeparator() : string
Inherited

Returns

string

Get HTML tag, if any, with which to surround label

getTag() : string

Returns

string

Get the class to apply to the HTML tag, if any, with which to surround label

getTagClass() : void

Remove single option

removeOption(mixed $key) : void
Inherited
inherited_from \Zend_Form_Decorator_Interface::removeOption()

Parameters

$key

mixed

Render a label

render(string $content) : string
inherited_from \Zend_Form_Decorator_Abstract::render()

Parameters

$content

string

Returns

string

Decorate content and/or element

render(string $content) : string
Inherited
inherited_from \Zend_Form_Decorator_Interface::render()

Parameters

$content

string

Exceptions

\Zend_Form_Decorator_Exception when unimplemented

Returns

string

Set options from config object

setConfig(\Zend_Config $config) : \Zend_Form_Decorator_Abstract
Inherited
inherited_from \Zend_Form_Decorator_Interface::setConfig()

Parameters

$config

\Zend_Config

Returns

\Zend_Form_Decorator_Abstract

Set current form element

setElement(\Zend_Form_Element|\Zend_Form $element) : \Zend_Form_Decorator_Abstract
Inherited

While the name is "setElement", a form decorator could decorate either an element or a form object.

inherited_from \Zend_Form_Decorator_Interface::setElement()

Parameters

$element

\Zend_Form_Element\Zend_Form

Exceptions

\Zend_Form_Decorator_Exception on invalid element type

Returns

\Zend_Form_Decorator_Abstract

Set element ID

setId(string $id) : \Zend_Form_Decorator_Label

Parameters

$id

string

Returns

\Zend_Form_Decorator_Label

Set option

setOption(string $key, mixed $value) : \Zend_Form_Decorator_Abstract
Inherited
inherited_from \Zend_Form_Decorator_Interface::setOption()

Parameters

$key

string

$value

mixed

Returns

\Zend_Form_Decorator_Abstract

Set options

setOptions(array $options) : \Zend_Form_Decorator_Abstract
Inherited
inherited_from \Zend_Form_Decorator_Interface::setOptions()

Parameters

$options

array

Returns

\Zend_Form_Decorator_Abstract

Set HTML tag with which to surround label

setTag(string $tag) : \Zend_Form_Decorator_Label

Parameters

$tag

string

Returns

\Zend_Form_Decorator_Label

Set the class to apply to the HTML tag with which to surround label

setTagClass(string $tagClass) : \Zend_Form_Decorator_Label

Parameters

$tagClass

string

Returns

\Zend_Form_Decorator_Label

Load an optional/required suffix/prefix key

_loadOptReqKey(string $key) : void

Parameters

$key

string

 Properties

 

$_element

$_element : \Zend_Form_Element | \Zend_Form

Default

 

Decorator options

$_options : array

Default

array()
 

Default placement: prepend

$_placement : string

Default

'PREPEND'
inherited_from \Zend_Form_Decorator_Abstract::_placement
 

Default placement: append

$_placement : string

Default

'APPEND'
 

Separator between new content and old

$_separator : string

Default

PHP_EOL
 

HTML tag with which to surround label

$_tag : string

Default

 

Class for the HTML tag with which to surround label

$_tagClass : string

Default

 Constants

 

Placement constants

APPEND = 'APPEND' 
 

Placement constants

IMPLICIT = 'IMPLICIT' 
 

IMPLICIT_APPEND

IMPLICIT_APPEND = 'IMPLICIT_APPEND' 
 

IMPLICIT_PREPEND

IMPLICIT_PREPEND = 'IMPLICIT_PREPEND' 
 

PREPEND

PREPEND = 'PREPEND'