xplo.re Medusa Core Framework 3.2
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Event
  • Todo
  • Download

Namespaces

  • Core
    • Authentication
      • Auto
        • Driver
      • Driver
    • Cache
      • Driver
    • Charset
      • Driver
    • Configuration
      • Driver
    • Controller
    • Converter
      • Driver
    • Decoder
      • Driver
    • Encoder
      • Driver
    • Env
      • Authentication
      • Locale
      • Proxy
      • Server
        • HTTP
        • Redirect
        • X
    • Exception
    • Exchange
      • Driver
    • Fault
      • Formatter
        • Driver
      • Incident
        • Exception
      • Reporter
        • Driver
    • Field
    • Filter
      • Driver
    • Formatter
      • Driver
        • coreuimarkup
          • Token
    • Hash
    • Loader
    • Locale
    • Log
      • Driver
    • Module
      • Dependency
        • Requirement
          • Core
          • PHP
      • Linkage
        • Driver
    • PDF
    • Plugin
    • Query
      • Driver
    • Server
      • Driver
    • Session
      • Driver
    • Set
    • Storage
      • Driver
      • Field
        • Element
    • Stream
      • Driver
    • String
    • Translation
      • Driver
      • Language
        • Driver
    • Type
    • URI
      • Driver
    • Version
    • View
      • Driver
        • coreui
          • Control
            • Button
            • Table
          • Element
        • htmlbuilder
          • Tags
        • yui
          • Modules
  • None
  • PHP

Classes

  • Node
  • Text

Class Node

HTML tag node.

A node can have an arbitrary number of child nodes. Child nodes are either other nodes, plain text or values that are converted to strings when the node is rendered as HTML.

Core\Object implements Core\Chainable
Extended by Core\Set implements Core\Accessor
Extended by Core\Set\Mutable implements Core\Mutator
Extended by Core\View\Driver\htmlbuilder\Node

Direct known subclasses

Core\View\Driver\htmlbuilder\Tags\COL, Core\View\Driver\htmlbuilder\Tags\COLGROUP, Core\View\Driver\htmlbuilder\Tags\SELECT, Core\View\Driver\htmlbuilder\Tags\TABLE, Core\View\Driver\htmlbuilder\Tags\TD, Core\View\Driver\htmlbuilder\Tags\TR, Core\View\Driver\htmlbuilder\Tags\UL, Core\View\Driver\htmlbuilder\Text, Core\View\Driver\htmlbuilder\Tags\FIELDSET, Core\View\Driver\htmlbuilder\Tags\FORM, Core\View\Driver\htmlbuilder\Tags\IMG, Core\View\Driver\htmlbuilder\Tags\INPUT, Core\View\Driver\htmlbuilder\Tags\LABEL, Core\View\Driver\htmlbuilder\Tags\OL, Core\View\Driver\htmlbuilder\Tags\OPTGROUP, Core\View\Driver\htmlbuilder\Tags\SCRIPT

Indirect known subclasses

Core\View\Driver\htmlbuilder\Tags\A, Core\View\Driver\htmlbuilder\Tags\DIV, Core\View\Driver\htmlbuilder\Tags\LEGEND, Core\View\Driver\htmlbuilder\Tags\LI, Core\View\Driver\htmlbuilder\Tags\P, Core\View\Driver\htmlbuilder\Tags\TBODY, Core\View\Driver\htmlbuilder\Tags\TEXTAREA, Core\View\Driver\htmlbuilder\Tags\TFOOT, Core\View\Driver\htmlbuilder\Tags\TH, Core\View\Driver\htmlbuilder\Tags\THEAD

Namespace: Core\View\Driver\htmlbuilder
Package: Core\View\HTMLBuilder
Since: 3.0
Requires: PHP 5.3
Version: 1.0
Located at View/Driver/htmlbuilder/Node.inc.php

Methods summary

public
# __clone( )

Creates deep clones of properties and resets the ID attribute.

Creates deep clones of properties and resets the ID attribute.

Since

3.0
protected
# __construct( Core\View\Driver\htmlbuilder $proxy, string $type, string $subType, array $classNames, string $id, array $extraArguments = null )

Node constructor.

Node constructor.

Parameters

$proxy
HTML Builder proxy instance that created this node.
$type
HTML tag name of element.
$subType
Specification of HTML tag, i.e. the type of an input.
$classNames
Array of class names to assign to the node.
$id
Unique ID of node.
$extraArguments
Array of additional arguments passed on from the factory method.

Since

3.0
public string
# __toString( )

Renders the HTML code for the node.

Renders the HTML code for the node.

Returns

string
Generated HTML code for the node.

Since

3.0

Overrides

Core\Object::__toString
protected static array
# _parseClasses( string $classes )

Parses a list of class names.

Parses a list of class names.

Parameters

$classes
Whitespace or comma-separated list of class names.

Returns

array
Array of extracted class names.

Since

3.0
public
# addClass( string $class )

Adds a CSS class.

Adds a CSS class.

Parameters

$class
CSS class name to assign to the node.

Returns


$this

Since

3.0
public Core\View\Driver\htmlbuilder\Node
# append( Core\View\Driver\htmlbuilder\Node|string $element )

Appends a new node to the list of child nodes.

Appends a new node to the list of child nodes.

Parameters

$element

Node instance to add. If a string is given, a new instance is created by delegating the call to the proxy view by calling the Core\View\Driver\htmlbuilder\htmlbuilder::deriven() method.

Returns

Core\View\Driver\htmlbuilder\Node
The node that was added to the list of children.

Since

3.0
public
# cdata( string $string )

Adds a new CDATA node to the list of child nodes.

Adds a new CDATA node to the list of child nodes.

Parameters

$string
Text to add wrapped in a CDATA node.

Returns


$this

Since

3.0
public static Core\View\Driver\htmlbuilder\Node
# derive( Core\View\Driver\htmlbuilder $proxy, string $description )

Element factory. Node

Element factory. Node

Parameters

$proxy
CoreUI proxy instance that creates the new element.
$description

Description string for the new node. Contains the tag name plus an optional sub-type separated by a plus sign and followed by a whitespace or comma-separated list of class names, then the unique ID of the node, and finally an arbitrary number of attributes separated by a slash in the form "key=value". Example:

Node::derive($proxy, 'input+text/left highlight/username/minlength=2/maxlength=10');

In the example an input text box of type "text" is created with the CSS classes "left" and "highlight" and the attributes "minlength" set to 2 and "maxlength" set to 10. The ID of the input is set to "username".

Additionally, depending on the node being created, further arguments are passed verbatim to the node constructor.

Returns

Core\View\Driver\htmlbuilder\Node

Since

3.0
public
# extend( Core\View\Driver\htmlbuilder\Node|string $element )

Appends a new child node but returns an instance to this node instead.

Appends a new child node but returns an instance to this node instead.

Parameters

$element
See Core\View\Driver\htmlbuilder\Node::append().

Returns


$this

Since

3.0
public string
# id( )

Returns the unique ID for the node. If no ID has been assigned when the node was created, an ID is automatically assigned to the node. Such an ID is generated. IDs are reset if a node is cloned.

Returns the unique ID for the node. If no ID has been assigned when the node was created, an ID is automatically assigned to the node. Such an ID is generated. IDs are reset if a node is cloned.

If the ID of an node is required but accessed for the first time after the node was rendered, and no explicit ID has been assigned to the node before, the rendered node does not have an ID set. In that case call this method before rendering the node.

Returns

string

ID of node. If non has been assigned yet, a random v4 UUID URN is assigned.

Since

3.0
public boolean
# issetStyle( string $styleName )

Tests, whether a specified style attribute is set.

Tests, whether a specified style attribute is set.

Parameters

$styleName
Name of style attribute to test for.

Returns

boolean

true, if a value is set for the specified style attribute, otherwise false.

Since

3.0
public
# js( string $code )

Inserts a JavaScript block (surrounded by a script tag) to the list of child nodes.

Inserts a JavaScript block (surrounded by a script tag) to the list of child nodes.

Parameters

$code
JavaScript code block to add.

Returns


$this

Since

3.0
public
# jsCDATA( string $code )

Adds a new CDATA node for JavaScript to the list of child nodes. Properly hides the CDATA markers within JavaScript comments.

Adds a new CDATA node for JavaScript to the list of child nodes. Properly hides the CDATA markers within JavaScript comments.

Parameters

$code
JavaScript code block to add.

Returns


$this

Since

3.0
public string
# safeID( )

Returns the node ID encoded for use with HTML node attributes. The characters »[« and »]« are replaced by minus signs, an auto-index ID is appended by the element's UUID.

Returns the node ID encoded for use with HTML node attributes. The characters »[« and »]« are replaced by minus signs, an auto-index ID is appended by the element's UUID.

Returns

string

Since

3.0
protected
# setAllowsShortTag( )

Leftover method from early development phase. Raises an exception to detect code pieces that still rely on the existence of the KVC value.

Leftover method from early development phase. Raises an exception to detect code pieces that still rely on the existence of the KVC value.

Deprecated

Throws

Core\Exception\MutationAttempt
KVC value is no longer available.

Since

3.0
public
# setAttribute( string $key, string $value )

Sets a HTML attribute.

Sets a HTML attribute.

Parameters

$key
Name of HTML key to set.
$value
Attribute value to set.

Returns


$this

Since

3.0
public
# setAttributes( array $attributes = null )

Sets an array of HTML attributes.

Sets an array of HTML attributes.

Parameters

$attributes
Associative array of attributes and their values to set.

Returns


$this

Since

3.0
public
# setId( string $newID )

Sets the new ID for the node.

Sets the new ID for the node.

Parameters

$newID
New ID to set or null to remove the current ID.

Returns


$this

Throws

Core\Exception\InvalidArgument
The provided ID is not XHTML conform.

Since

3.0
public
# setStyle( string $style )

Sets style attributes.

Sets style attributes.

Does not overwrite all style attributes but merges the existing set of style attributes with the new style attributes and values.

Parameters

$style

String of CSS style definitions that is automatically parsed by this method.

Returns


$this

Since

3.0
public
# setTitle( string $title )

Sets the HTML title attribute.

Sets the HTML title attribute.

Parameters

$title
Title to set or null to remove the attribute.

Returns


$this

Since

3.0
public
# text( string $text )

Appends a new text node to the list of child nodes.

Appends a new text node to the list of child nodes.

Parameters

$text

Text to append to list of child nodes. The text is automatically encoded using the encoder of the proxy view.

Returns


$this

Since

3.0
public
# verbatim( mixed $value )

Appends a given arbitrary value verbatim to the list of child nodes.

Appends a given arbitrary value verbatim to the list of child nodes.

Parameters

$value
Value to append to the list of child nodes.

Returns


$this

Since

3.0

Methods inherited from Core\Set\Mutable

__set(), __unset()

Methods inherited from Core\Set

__get(), __isset()

Methods inherited from Core\Object

__autocreateFactory(), __call(), __processParameters(), attachMethod(), chain(), getValueForKey(), getValueForKeyPath(), getValueForUndefinedKey(), hash(), issetValueForKey(), setValueForKey(), setValueForKeyPath(), setValueForUndefinedKey(), uuid()

Constants summary

boolean AllowsInnerNL

If set, the rendering of the HTML tag represented by the node is not affected by newlines inside the tag.

If set, the rendering of the HTML tag represented by the node is not affected by newlines inside the tag.

Since

3.0
# false
boolean AllowsOuterNL

If set, the rendering of the HTML tag represented by the node is not affected by newlines outside the tag.

If set, the rendering of the HTML tag represented by the node is not affected by newlines outside the tag.

Since

3.0
# false
boolean AllowsShortTag

If set, the HTML tag represented by the node allows short tag notion.

If set, the HTML tag represented by the node allows short tag notion.

Since

3.0
# true

Constants inherited from Core\Object

AnyParameterType, AutochainParameterType, AutocreateParameterType, BooleanParameterType, CharParameterType, EnumParameterType, IntegerParameterType, RealParameterType, StringParameterType, UserParameterType

Properties summary

protected ArrayObject $_v_attributes

Associative array of node attributes. The actual class used is defined via the attribute class attribute.

Associative array of node attributes. The actual class used is defined via the attribute class attribute.

Since

3.0
#
protected string $_v_attributeClass

Name of class to use for storing attributes. Should be compatible to an array object that allows getting/setting entries using array syntax.

Name of class to use for storing attributes. Should be compatible to an array object that allows getting/setting entries using array syntax.

Since

3.0
# '\ArrayObject'
protected mixed[] $_v_children

Array of child nodes.

Array of child nodes.

Since

3.0
#
protected ArrayObject $_v_classes

Array of assigned CSS classes.

Array of assigned CSS classes.

Since

3.0
#
protected Core\View\Driver\htmlbuilder $_v_proxy

HTML Builder proxy driver instance.

HTML Builder proxy driver instance.

Since

3.0
#
protected array $_v_styles

Associative array of inline styles.

Associative array of inline styles.

Since

3.0
#
protected string $_v_type

HTML tag name.

HTML tag name.

Since

3.0
#
protected string $_id

Assigned ID of element, automatically generated by the Core\View\Driver\htmlbuilder\Node::id() method if not set at time of creation.

Assigned ID of element, automatically generated by the Core\View\Driver\htmlbuilder\Node::id() method if not set at time of creation.

Since

3.0
#
protected string $_safeID

Calculated safe ID for use as a HTML attribute.

Calculated safe ID for use as a HTML attribute.

Since

3.0
#

Magic properties

public read-only ArrayObject $attributes

Associative array of node attributes.

public read-only string $attributeClass

Name of class used for attributes.

public read-only ArrayObject $classes

Array of assigned CSS classes.

public read-only string $id

Unique node ID.

public read-only Core\View\Driver\htmlbuilder $proxy

HTML Builder proxy driver instance.

public read-only string $safeID

Unique node ID encoded for use within HTML node attributes.

public read-only array $styles

Associative array of inline styles.

public read-only string $type

HTML tag name.

Magic properties inherited from Core\Object

$hash, $uuid

xplo.re Medusa Core Framework 3.2 API documentation generated by ApiGen