Actions

Translations

Translations:Plugins - advanced/110/en

From LimeSurvey Manual

// Inside init() Yii::app()->formExtensionService->add(

   'globalsettings.general',
   new TextInput([
       'name' => 'myinput',
       'label' => 'Label',
       'disabled' => true,
       'tooltip' => 'Moo moo moo',
       'help' => 'Some help text',
       'save' => function($request, $connection) {
           $value = $request->getPost('myinput');
           if ($value === 'some invalid value') {
               throw new SaveFailedException("Could not save custom input 'myinput'");
           } else {
               SettingGlobal::setSetting('myinput', $value);
           }
       },
       'load' => function () {
           return getGlobalSetting('myinput');
       }
   ])

); </syntaxhighlight>