TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder Class Reference
Inheritance diagram for TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder:
Tx_Fluid_Core_ViewHelper_TagBuilder

Public Member Functions

 __construct ($tagName='', $tagContent='')
 
 setTagName ($tagName)
 
 getTagName ()
 
 setContent ($tagContent)
 
 getContent ()
 
 hasContent ()
 
 forceClosingTag ($forceClosingTag)
 
 hasAttribute ($attributeName)
 
 getAttribute ($attributeName)
 
 getAttributes ()
 
 addAttribute ($attributeName, $attributeValue, $escapeSpecialCharacters=TRUE)
 
 addAttributes (array $attributes, $escapeSpecialCharacters=TRUE)
 
 removeAttribute ($attributeName)
 
 reset ()
 
 render ()
 

Protected Attributes

 $tagName = ''
 
 $content = ''
 
 $attributes = array()
 
 $forceClosingTag = FALSE
 

Detailed Description

Tag builder. Can be easily accessed in AbstractTagBasedViewHelper

Definition at line 19 of file TagBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::__construct (   $tagName = '',
  $tagContent = '' 
)

Constructor

Parameters
string$tagNamename of the tag to be rendered
string$tagContentcontent of the tag to be rendered

Definition at line 57 of file TagBuilder.php.

References TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\$tagName, TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\setContent(), and TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\setTagName().

Member Function Documentation

◆ addAttribute()

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::addAttribute (   $attributeName,
  $attributeValue,
  $escapeSpecialCharacters = TRUE 
)

Adds an attribute to the $attributes-collection

Parameters
string$attributeNamename of the attribute to be added to the tag
string$attributeValueattribute value
boolean$escapeSpecialCharactersapply htmlspecialchars to attribute value
Returns
void

Definition at line 172 of file TagBuilder.php.

Referenced by TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\addAttributes().

◆ addAttributes()

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::addAttributes ( array  $attributes,
  $escapeSpecialCharacters = TRUE 
)

Adds attributes to the $attributes-collection

Parameters
array$attributescollection of attributes to add. key = attribute name, value = attribute value
boolean$escapeSpecialCharactersapply htmlspecialchars to attribute values#
Returns
void

Definition at line 187 of file TagBuilder.php.

References TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\addAttribute().

◆ forceClosingTag()

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::forceClosingTag (   $forceClosingTag)

Set this to TRUE to force a closing tag E.g. <textarea> cant be self-closing even if its empty

Parameters
boolean$forceClosingTag

Definition at line 124 of file TagBuilder.php.

References TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\$forceClosingTag.

Referenced by TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\render(), and TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\reset().

◆ getAttribute()

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::getAttribute (   $attributeName)

Get an attribute from the $attributes-collection

Parameters
string$attributeNamename of the attribute
Returns
string The attribute value or NULL if the attribute is not registered

Definition at line 146 of file TagBuilder.php.

References TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\hasAttribute().

◆ getAttributes()

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::getAttributes ( )

Get all attribute from the $attributes-collection

Returns
array Attributes indexed by attribute name

Definition at line 159 of file TagBuilder.php.

References TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\$attributes.

◆ getContent()

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::getContent ( )

Gets the content of the tag

Returns
string content of the tag to be rendered

Definition at line 100 of file TagBuilder.php.

References TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\$content.

◆ getTagName()

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::getTagName ( )

Gets the tag name

Returns
string tag name of the tag to be rendered

Definition at line 79 of file TagBuilder.php.

References TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\$tagName.

◆ hasAttribute()

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::hasAttribute (   $attributeName)

Returns TRUE if the tag has an attribute with the given name

Parameters
string$attributeNamename of the attribute
Returns
boolean TRUE if the tag has an attribute with the given name, otherwise FALSE

Definition at line 135 of file TagBuilder.php.

Referenced by TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\getAttribute().

◆ hasContent()

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::hasContent ( )

Returns TRUE if tag contains content, otherwise FALSE

Returns
boolean TRUE if tag contains text, otherwise FALSE

Definition at line 110 of file TagBuilder.php.

Referenced by TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\render().

◆ removeAttribute()

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::removeAttribute (   $attributeName)

Removes an attribute from the $attributes-collection

Parameters
string$attributeNamename of the attribute to be removed from the tag
Returns
void

Definition at line 200 of file TagBuilder.php.

◆ render()

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::render ( )

◆ reset()

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::reset ( )

Resets the TagBuilder by setting all members to their default value

Returns
void

Definition at line 210 of file TagBuilder.php.

References TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\forceClosingTag().

◆ setContent()

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::setContent (   $tagContent)

Sets the content of the tag

Parameters
string$tagContentcontent of the tag to be rendered
Returns
void

Definition at line 90 of file TagBuilder.php.

Referenced by TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\__construct().

◆ setTagName()

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::setTagName (   $tagName)

Sets the tag name

Parameters
string$tagNamename of the tag to be rendered
Returns
void

Definition at line 69 of file TagBuilder.php.

References TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\$tagName.

Referenced by TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder\__construct().

Member Data Documentation

◆ $attributes

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::$attributes = array()
protected

◆ $content

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::$content = ''
protected

◆ $forceClosingTag

TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::$forceClosingTag = FALSE
protected

◆ $tagName