-
Notifications
You must be signed in to change notification settings - Fork 34
classes_base_renderable.class
Base class for all HTML related stuff.
Implements: <>
Inserts content after this element.
Definition: public function after($content)
Returns: static
Parameters:
-
mixed $contentContent to be inserted
Appends content to this Renderable.
This works exactly as Renderable::content but will return $this instead of the appended content.
Definition: public function append($content)
Returns: static
Parameters:
-
mixed $contentThe content to be appended
Append this Renderable to another Renderable.
Definition: public function appendTo($target)
Returns: static
Parameters:
-
mixed $targetObject of type Renderable
Captures $this to the given $variable.
This may me used to capture an instance from a method chain like this:
TextInput::Make()->capture($tb)->appendTo($some_container)->par()->prepend($tb->CreateLabel('enter mail:')); Definition: public function capture($variable)
Returns: static
Parameters:
-
static $variableVariable to assign$thisto
INTERNAL Prepares given resources to be processed
Clears all contents.
Definition: public function clearContent()
Returns: static
Returns the next Control of a given type when stepping up the object tree.
Definition: public function closest($classname)
Returns: mixed The closest object or false if not found
Parameters:
-
string $classnameClass to search for
Adds content to the Renderable.
Note that this will not return $this but the $content.
This allows for method chaining like this:
$this->content( new Control('div') )->css('border','1px solid red')->addClass('mydiv')->content('DIVs content'); Definition: public function content($content, $replace=false)
Returns: T The content added
Parameters:
-
T $contentThe content to be added -
bool $replaceif true replaces the whole content.
Returns the first content. Note that this does not behave like Renderable::get(0) because it wont throw an Exception when there's no content, but return a new empty Control object.
Definition: public function first()
Returns: Renderable First content or new empty Control
Gets the content at index $index.
Definition: public function get($index)
Returns: mixed Content at index $index
Parameters:
-
int $indexZero based index of content to get
INTERNAL Returns the current rendering object.
INTERNAL Gets the current rendering root object
Returns if there is an element in the content with the given instance type
Definition: public function hasContentOfInstance($type)
Returns: bool True if an element of given instance was found
Parameters:
-
mixed $typeInstance type to search for (via InstanceOf)
INTERNAL Checks if the rendering stack is empty
INTERNAL Checks if there's a current rendering root object
Returns the zero based index of $content.
Checks the content array for the given $content and returns it's index of found.
Returns -1 if not found.
Definition: public function indexOf($content)
Returns: int Zero based index or -1 if not found
Parameters:
-
mixed $contentContent to search for
Inserts something to the contents of this Renderable.
Definition: public function insert($content, $index)
Returns: static
Parameters:
-
mixed $contentContent to be prepended -
int|static $indexZero base index where to insert OR Renderable to insert before
Adds this Renderable before another Renderable. In fact it will be inserted before the other Renderable into the other Renderables parent.
Definition: public function insertBefore($target)
Returns: static
Parameters:
-
Renderable $targetObject of type Renderable
Check if this is part of another objects tree.
Definition: public function isChildOf(Renderable $object)
Returns: bool True if this is child of object, else false
Parameters:
-
Renderable $objectRoot object to test
Returns all data needed for serializing this object into JSON. Note: This does not return a string, but an object to be serialized.
Definition: public function jsonSerialize()
Returns: object|array If SlimSerialisation is active, returns an array, else returns $this
Returns the last content. Note that this does not behave like Renderable::get(<last_index>) because it wont throw an Exception when there's no content at last_index, but return a new empty Control object.
Definition: public function last()
Returns: Renderable Last content or new empty Control
Gets the number of contents.
Definition: public function length()
Returns: int Length of the contents array
Return $this objects direct successor.
Checks the parents content for $this and returns the object that was inserted directly after $this.
Note that this method may throw an Exception when there's no parent or if $this is the last child.
Definition: public function next()
Returns: Renderable This objects successor in it's parent's content
Returns this Renderables parent object.
Note that this will throw an Exception when $this has not (yet) been added to another Renderable.
Definition: public function par()
Returns: Renderable Parent object
INTERNAL Removes an object from the rendering stack.
Prepends something to the contents of this Renderable.
Definition: public function prepend($content)
Returns: static
Parameters:
-
mixed $contentContent to be prepended
Prepends this Renderable to another Renderable.
Definition: public function prependTo($target)
Returns: static
Parameters:
-
mixed $targetObject of type Renderable
INTERNAL Dummy. Can be used in subclasses by overriding.
Return $this objects direct predecessor.
Checks the parents content for $this and returns the object that was inserted directly before $this.
Note that this method may throw an Exception when there's no parent or if $this is the first child.
Definition: public function prev()
Returns: Renderable This objects predecessor in it's parent's content
INTERNAL Adds an object to the rendering stack.
Removes content.
Definition: public function rmContent($content)
Returns: static
Parameters:
-
mixed $contentThe content to be removed
Adds JavaScript-Code to the Renderable object.
Definition: public function script($scriptCode)
Returns: static
Parameters:
-
array|string $scriptCodeJS code to be added
INTERNAL Starts slim serialization mode (see Renderable::jsonSerialize)
INTERNAL Stops slim serialization mode (see Renderable::jsonSerialize)
Renders this Renderable. Extending classes must implement this (Control, Template).
Definition: public abstract function WdfRender()
Returns: string The rendered object
Renders this Renderable as controller. Extending classes must implement this (Control, Template).
Definition: public abstract function WdfRenderAsRoot()
Returns: string The rendered object
Renders this instance without dependencies direcly.
Definition: public function WdfRenderInline()
Returns: string Rendered HTML content
Wraps this Renderable into another one. Not words, just samples:
$wrapper = new Control('div');
$inner = new Control('span');
$inner->content('INNER');
$inner->wrap($wrapper)->content("I am below 'INNER'");
// or
$inner = new Control('span');
$inner->content('INNER');
$inner->wrap('div')->content("I am below 'INNER'");
// or
$inner = new Control('span');
$inner->content('INNER');
$inner->wrap(new Control('div'))->content("I am below 'INNER'"); Definition: public function wrap($tag_or_obj)
Returns: Renderable The (new) wrapping control
Parameters:
-
mixed $tag_or_objString or Renderable, see samples
Definition: protected function __collectResourcesInternal($template, $static_stack)
Returns: array
Parameters:
-
$templateNOT DOCUMENTED -
$static_stackNOT DOCUMENTED
Definition: public function __toString()
Returns: string