LBWeb::loglevel_select_html

$html = LBWeb::loglevel_select_html( array $params );

 

Returns ready HTML code for the plugin loglevel dropdown list. The loglevel setting of the html is saved in the LoxBerry plugin database, therefore this is the same selection as in the plugin management and Log Manager.

LoxBerry Compatibility

This function is available starting with LoxBerry V1.2.5. If you use that function, set this minimum version in your plugin.cfg.

The function returns a string with HTML code to show a user dropdown to select the loglevel for this plugin. With parameters, you can control the visuals. The current loglevel is automatically preselected from the plugin database.

To give parameters to the function, use named parameters.

Your plugin needs to enable CUSTOM_LOGLEVELS=true in the plugin.cfg, otherwise the function returns an empty string and warns using error_log().

Parameter

Case sensitivity

All parameter names are case-sensitive and written in capital letters.

ParameterOptionalUsage
LABEL x By default, LoxBerry uses the language specific default label "Loglevel" as label for the dropdown.

* To use a userdefined preceding label, use the LABEL parameter with your (language specific) string.
* To disable the label tag in the html, use "LABEL" => "".
FORMID x This is the name and id of the form element. This name is used on submitting a form, or reading the value with JavaScript.

Default is "select_loglevel".
DATA_MINIx By default, the function uses the jQuery Mobile tag data-mini="true". To have the full-sized button, send "DATA_MINI" ⇒ 0.
PLUGIN x The function automatically detects your plugin.

If the detection fails, it will raise a warning with error_log(). In this case, send your $lbpplugindir variable with "PLUGIN" ⇒ $lbpplugindir.

Return value

Returns a string that is the HTML and JavaScript code for the loglevel selection. Simply echo the result of the function to your webpage.

Usage

require_once "loxberry_web.php";
# For default settings, no parameters are needed
$loglevelhtml = LBWeb::loglevel_select_html();
 
# Use the form id 'loglevel', and don't use DATA_MINI
$loglevelhtml = LBWeb::loglevel_select_html( [ "FORM" => "loglevel", "DATA_MINI" => 0 ] );
 
 
# Don't use a label
$loglevelhtml = LBWeb::loglevel_select_html( [ "LABEL" => "" ] );
 
# Print it to the ui
echo $loglevelhtml;