<?php
namespace Wpupgrader\Libraries\WordPress\Plugins\Core\Settings\Page\Callback;

use Wpupgrader\Libraries\WordPress\Plugins\Core\Settings\Page\Callback;

class Tabtoggle extends Callback
{
    public function callbackAction()
    {
        \printf('<input type="checkbox" value="1" %s %s toggle hidden /><label for="%s"></label>', $this->getNameIdString(), \checked(1, $this->getValue(), false), $this->getIdString());
        echo '<p>'.$this->getDescription().'</p>';
        ?>
		<script>
            jQuery("#<?php echo $this->getIdString();?>").on('click change', function(e) {
                jQuery(this).parent().parent().toggleClass("disabled", !jQuery("#<?php echo $this->getIdString();?>").is(":checked"));
            }).trigger('change');
		</script>
        <?php
    }
}
