Add new ISettingsGroup to ISettingsBundle

Is there a method in any of the SDL APIs for adding a new SettingsGroup to a project's ISettingsBundle? I see there are methods for importing from an existing group and removing groups, but none for adding a new group. I'm guessing this is because SDL doesn't want you to instantiate SettingsGroups on your own and just use what they provide. Problem is, I'm trying to take a SettingsGroup for QuickInserts from a project template and add it to the ISettingsBundle for an active project, but I don't have a way to create the new group or to add it when it's created.

Anybody have ideas on how to do this?

Thanks,

Ryan L.

Parents
  • Hi Ryan,

    I got a little advice from one of our Professional Services developers.  At the moment it's not recommended to do this, and we don't think you can using the API.  However there may be a few ways to tackle this:

    1. you can use the project templates
    2. you can add new settings but read and change the existing ones using ISettingBundle and ISettingsGroup
      To read the project settings use FileBasedProject.GetSettings() method.
      This returns the ISettingsBundle which can be used to query for a desired SettingsGroup (in our sample below the id of the settings group is the file type name “XML: Any v 1.2.0.0”)
      Like this ISettingsBundle.GetSettingsGroup(“XML: Any v 1.2.0.0”). Then you could get the desired setting with GetSetting(id) and change it by setting the Value property.
        
    3. To add settings programmatically you need to use a ‘hack’ again and edit the project XML in the code.
      In this way you could insert the QuickInsert settings per project type you need

    It is likely that development will take these settings out of the file type and into the project and then expose them in the public API in a future release.

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

Reply
  • Hi Ryan,

    I got a little advice from one of our Professional Services developers.  At the moment it's not recommended to do this, and we don't think you can using the API.  However there may be a few ways to tackle this:

    1. you can use the project templates
    2. you can add new settings but read and change the existing ones using ISettingBundle and ISettingsGroup
      To read the project settings use FileBasedProject.GetSettings() method.
      This returns the ISettingsBundle which can be used to query for a desired SettingsGroup (in our sample below the id of the settings group is the file type name “XML: Any v 1.2.0.0”)
      Like this ISettingsBundle.GetSettingsGroup(“XML: Any v 1.2.0.0”). Then you could get the desired setting with GetSetting(id) and change it by setting the Value property.
        
    3. To add settings programmatically you need to use a ‘hack’ again and edit the project XML in the code.
      In this way you could insert the QuickInsert settings per project type you need

    It is likely that development will take these settings out of the file type and into the project and then expose them in the public API in a future release.

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

Children
No Data