We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36398
    • 13 Posts
    Hy, i want to create a new system setting from a snippet. I get it to run with newObject('modSystemSetting') but i miss a field the name of the field and i think that is the reason why i can not edit my new setting from the settings menu.

    Hope you can help, thanks
      • 33968
      • 863 Posts
      Check you are setting the following properties (not sure if all are required). You might also be forgetting to save the setting... try something like this:
      $newSetting = array(
          'key' => 'mySetting',
          'value' => 'value',
          'xtype' => 'textfield',
          'namespace' => 'core',
          'area' => 'My Settings',
      );
      
      $setting = $modx->newObject('modSystemSetting', $newSetting);
      $setting->save();