public function autoToggle($Sender, $Redirect = null)
{
deprecated('Gdn_Plugin->autoToggle()');
$PluginName = $this->getPluginIndex();
$EnabledKey = "Plugins.{$PluginName}.Enabled";
$CurrentConfig = c($EnabledKey, false);
$PassedKey = val(1, $Sender->RequestArgs);
if ($Sender->Form->authenticatedPostBack() || Gdn::session()->validateTransientKey($PassedKey)) {
$CurrentConfig = !$CurrentConfig;
SaveToConfig($EnabledKey, $CurrentConfig);
}
if ($Sender->Form->authenticatedPostBack()) {
$this->controller_index($Sender);
} else {
if ($Redirect === false) {
return $CurrentConfig;
}
if (is_null($Redirect)) {
Redirect('plugin/' . strtolower($PluginName));
} else {
Redirect($Redirect);
}
}
return $CurrentConfig;
}