-
Notifications
You must be signed in to change notification settings - Fork 34
classes_base_control.class
Base class for interactive webpage content like AJAX TextInputs.
Extends: Renderable
Subclasses: Anchor, CanvasGauge, ChartJS3, ColGroup, ContextMenu, Datamap, Form, GoogleControl, HtmlList, HtmlListItem, Image, ImageButton, ImageLink, Input, Label, LeafLet, Select, Table, TBody, Td, TextArea, TimeFormatEx, Toggle, Tr, uiControl, uiNavigationItem, uiTreeNode, WdfListing
Adds a value to the 'class' attribute. Note: you may pass multiple classes at once in a tring space separated: 'cls1 cls2'
Definition: public function addClass($class)
Returns: static
Parameters:
-
string $classCSS class(es)
SHORTCUT Control
Attribute handling. This method may be used in four different ways:
- to get all attributes
- to get one attribute
- to set one attribute
- to set many attributes
To achieve this pass different parameters into like this:
- $c->attr() returns all attributes
- $c->attr('name') returns the 'name' attributes value
- $c->attr('name','mycontrol') sets the 'name' attribute values
- $c->attr(['name'=>'myname','href'=>'my.domain']) sets 'name' and 'href' attribute values
Note: Will return $this in cases 3. and 4. (the set cases).
Definition: public function attr($args)
Returns: static|mixed $this, an attribute value or an array of attribute values
Parameters:
-
mixed $argsArguments as described
Overrides Renderable::capture to ensure a valid id.
Definition: public function capture($variable)
Returns: static
Parameters:
-
static $variableVariable to assign$thisto
Checks whether this control needs a closing tag (in HTML code).
Definition: protected function CloseTagNeeded()
Returns: bool true if needed
Adds a CSS property to the control. If value is an integer (or numeric string like '12') 'px' will be added.
Definition: public function css($name, $value)
Returns: static
Parameters:
-
string $nameName of the CSS property (like width, background-image,...) -
string $valueValue of the CSS property
data-* attribute Handling This work exaclty like Control::attr but with all the data-* attributes.
Definition: public function data($args)
Returns: static|mixed $this, a data-attribute value or an array of data-attributes
Parameters:
-
mixed $argsArguments as described
Checks if the given attribute is valid for a html element like this (depending on tag).
Definition: protected function IsAllowedAttribute($attr)
Returns: bool true if valid
Parameters:
-
string $attrThe attribute to check
Static creator method This is cabable of creating derivered classes too:
Control::Make('div')->content('Doh!');
TextInput::Make()->css('width','300px'); Arguments will be passed to constructor.
Definition: public static function Make($args)
Returns: static The created control
Parameters:
-
mixed $argsArguments as described
INTERNAL Will be executed on HOOK_PRE_RENDER. Adds this controls init code to rendering HtmlPage if root is of that type.
Removes attribute $name.
Definition: public function removeAttr($name)
Returns: static
Parameters:
-
string $nameAttribute name
Removes a value from the 'class' attribute.
Definition: public function removeClass($class)
Returns: static
Parameters:
-
string $classCSS class
Removes a data-$name attribute.
Definition: public function removeData($name)
Returns: static
Parameters:
-
string $nameData name
DEPRECATED (2021/10) Use Control::data instead Set a value to a data-$name attribute. Those can be accessed in JS easily using jQuery.data method
Sets the title attribute.
Definition: public function setTitle($title)
Returns: static
Parameters:
-
string $titleValue for the title-atribute
OVERRIDE Renderable::WdfRender
OVERRIDE Renderable::WdfRenderAsRoot
Constructs a Control
Definition: public function __construct($tag)
Returns: NOT DOCUMENTED
Parameters:
-
string $tagThe HTML Tag of this control. Default ""
INTERNAL Magic method __get. See Member overloading
INTERNAL Magic method __isset. See Member overloading
INTERNAL Checks if this class implements a method.
INTERNAL Magic method __set. See Member overloading
These are HTML tags. Each (1st dimension) array key represents a tag and the value (array) contains all attributes that are allowed to use with it.
Definition: public function __toString()
Returns: NOT DOCUMENTED