Skip to content

Commit

Permalink
Added support for custom icons to command and text modules
Browse files Browse the repository at this point in the history
  • Loading branch information
noccy80 committed Dec 18, 2016
1 parent 530158c commit 86d5fe0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion modules/command.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

define("COMMAND_CLASS", "class");
define("COMMAND_EXEC", "exec");
define("COMMAND_ICON", "icon");

function _command(array $opts) {
$attr = [
Expand All @@ -12,8 +13,12 @@ function _command(array $opts) {
} else {
$output = null;
}
if (!empty($opts[COMMAND_ICON])) {
$output = icon($opts[COMMAND_ICON]).$output;
}
return panel($output, $attr, 'command');
}
module("command", "Execute a command and display the output");
option("exec",COMMAND_EXEC,OPT_TYPE_STRING,"Command to execute","");
option("class",COMMAND_CLASS,OPT_TYPE_STRING,"The class to use","system");
option("class",COMMAND_CLASS,OPT_TYPE_STRING,"The class to use","system");
option("icon",COMMAND_ICON,OPT_TYPE_STRING,"Name of custom icon to be put in front of the output","");
5 changes: 4 additions & 1 deletion modules/text.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

define("TEXT_TEXT", "text");
define("TEXT_CLASS", "class");
define("TEXT_ICON", "icon");

function _text(array $opts) {
$attr = [];
if ($opts[TEXT_CLASS]) $attr['class'] = $opts[TEXT_CLASS];
return panel($opts[TEXT_TEXT], $attr, 'text');
$icon = (!empty($opts[TEXT_ICON]))?icon($opts[TEXT_ICON]):"";
return panel($icon.$opts[TEXT_TEXT], $attr, 'text');
}
module("text", "Show a static text");
option("text", TEXT_TEXT, "string", "The text to dispaly", "Text");
option("class", TEXT_CLASS, "string", "The class to use", "info");
option("icon", TEXT_ICON,OPT_TYPE_STRING,"Name of custom icon to be put in front of the output","");

0 comments on commit 86d5fe0

Please sign in to comment.