51 lines
1.0 KiB
PHP
51 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace WoWPress\Frontend;
|
|
|
|
class ToggleButton{
|
|
|
|
private $id;
|
|
public $row = true;
|
|
public $icons = true;
|
|
public $gray = true;
|
|
public $type = "checkbox";
|
|
public $name;
|
|
public $checked;
|
|
public $disabled;
|
|
public $text;
|
|
public $icon_yes = "o-check-badge";
|
|
public $icon_no = "o-no-symbol";
|
|
|
|
public $color_yes = "monk";
|
|
public $color_no = "monk";
|
|
|
|
public function __construct($args)
|
|
{
|
|
|
|
foreach($args as $key => $value){
|
|
if(property_exists(self::class,$key)){
|
|
$this->$key = $value;
|
|
}
|
|
|
|
if(!empty($args['color'])){
|
|
$this->color_yes = $args['color'];
|
|
$this->color_no = $args['color'];
|
|
|
|
}
|
|
|
|
if(empty($this->id)){
|
|
$this->id = uniqid();
|
|
}
|
|
if(empty($this->name)){
|
|
$this->name = uniqid();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public function render(){
|
|
require(get_template_directory()."/components/toggle-button.php");
|
|
}
|
|
|
|
} |