yf_html5fw classAbstraction layer over HTML5/CSS frameworks: conf('css_framework') = bs3 (default), bs4, bs5 or empty (no framework classes).
| File | plugins/html/classes/yf_html5fw.class.php |
|---|---|
| Use | _class('html5fw') |
A site sets them in its config with $PROJECT_CONF['html5fw']['NAME'] = ...;
| Property | Default | Description |
|---|---|---|
$DEFAULT_CSS_FRAMEWORKstring |
'bs3' |
used when conf('css_framework') is empty (yf_main::init_constants() sets bs3) |
$REMOVED_CSS_FRAMEWORKSarray |
['bs2' => 'Bootstrap 2', 'foundation' => 'Zurb Foundation', 'pure' => 'Pure CSS', 'semantic_ui' => 'Semantic UI', 'uikit' => 'UIkit', 'maxmert' => 'Maxmertkit'] |
Deleted frameworks: name => reason; a requested one warns once per request and renders with the `empty` driver |
$_removed_warnedarray |
[] |
@conf_skip removed names already reported in this request |
public function form_dd_row($content, $extra = [], $replace = [], $obj = null)
public function form_dd_row($content, $extra = [], $replace = [], $obj = null)
{
return $this->_driver($extra)->form_dd_row($content, $extra, $replace, $obj);
}
public function form_render_out($content, $extra = [], $replace = [], $obj = null)
public function form_render_out($content, $extra = [], $replace = [], $obj = null)
{
return $this->_driver($extra)->form_render_out($content, $extra, $replace, $obj);
}
public function form_row($content, $extra = [], $replace = [], $obj = null)
public function form_row($content, $extra = [], $replace = [], $obj = null)
{
return $this->_driver($extra)->form_row($content, $extra, $replace, $obj);
}
_ hooks and helpers; not routable as page actionspublic function __call($name, $args)
Catch missing method call.
public function __call($name, $args)
{
return main()->extend_call($this, $name, $args);
}
public function __clone()
We cleanup object properties when cloning.
public function __clone()
{
foreach ((array) get_object_vars($this) as $k => $v) {
$this->$k = null;
}
}
public function __toString(): string
Need to avoid calling render() without params.
public function __toString()
{
try {
return (string) $this->render();
} catch (Exception $e) {
return '';
}
}
public function _driver($extra = [])
The driver for the per-call css_framework, else conf('css_framework'), else DEFAULT_CSS_FRAMEWORK.
public function _driver($extra = [])
{
$per_call = is_array($extra) && is_scalar($extra['css_framework'] ?? null) ? $extra['css_framework'] : '';
$name = (string) ($per_call ?: conf('css_framework') ?: $this->DEFAULT_CSS_FRAMEWORK);
if (isset($this->REMOVED_CSS_FRAMEWORKS[$name])) {
if ( ! isset($this->_removed_warned[$name])) {
$this->_removed_warned[$name] = true;
trigger_error('HTML5FW: css_framework "' . $name . '" (' . $this->REMOVED_CSS_FRAMEWORKS[$name] . ') was removed, see https://github.com/yfix/yf/blob/master/docs/UPGRADING.md; rendering with "empty", use bs3, bs4 or bs5', E_USER_WARNING);
}
$name = 'empty';
}
return _class('html5fw_' . $name, 'classes/html5fw/');
}