public form ( Gdn_Form $NewValue = null ) : Gdn_Form | ||
$NewValue | Gdn_Form | |
Résultat | Gdn_Form |
/** * Settings page. * * @param SettingsController $Sender */ public function settingsController_akismet_create($Sender) { // Allow for master hosted key $KeyDesc = 'Enter the key you obtained from <a href="http://akismet.com">akismet.com</a>'; if (c('Plugins.Akismet.MasterKey')) { $KeyDesc = 'No key is required! You may optionally use your own.'; } $Sender->permission('Garden.Settings.Manage'); $Sender->setData('Title', t('Akismet Settings')); $Cf = new ConfigurationModule($Sender); // Do key validation so we don't break our entire site. // Always allow a blank key, because the plugin turns off in that scenario. if (Gdn::request()->isAuthenticatedPostBack()) { $key = $Cf->form()->getFormValue('Plugins.Akismet.Key'); if ($key !== '' && !$this->validateKey($key)) { $Cf->form()->addError('Key is invalid.'); } } // Settings to be shown. $options = ['Plugins.Akismet.Key' => ['Description' => $KeyDesc]]; // Deprecated TypePad option should go away if it's not already set. if (c('Plugins.Akismet.Server')) { $options['Plugins.Akismet.Server'] = ['Description' => 'You can use either Akismet or TypePad antispam.', 'Control' => 'DropDown', 'Items' => ['' => 'Akismet', 'api.antispam.typepad.com' => 'TypePad']]; } $Cf->initialize($options); $Sender->addSideMenu('settings/plugins'); $Cf->renderAll(); }