2024-04-16 15:25:22 +02:00
|
|
|
<?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";
|
2024-04-23 00:44:42 +02:00
|
|
|
public $value = "";
|
|
|
|
|
2024-04-16 15:25:22 +02:00
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|