CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Settings API
Pages: [1] 2 3 4

Author Topic: Settings API  (Read 5877 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Settings API
October 07, 2012, 06:21:04 pm
I have committed the setting api into trunk (sponsored by JMA consulting). This allows the following actions

- get
- create
- getvalue (intended for runtime use, more required params)
- getfields
- getdefaults
- revert
- fill

With the exception of getvalue these actions leverage xml definitions of the various settings. As the settings are stored as a serialised string the create action needs to know the variable type and this is defined in the xml - along with other metadata such as a validation callback & the default value.

It is possible for a module to add it's own path to the metadata to be loaded and for it to alter the metadata from the core xml. A likely scenario is that a module wishes to change / set various defaults to reflect localisation of currency, address format etc. The module may choose to revert various settings back to the defaults it has defined (e.g. on installation) or only to 'fill' those defaults in if they don't exist.

There is still a fair bit of tidying to do / things to be mulled / questions to be answered. The ticket is http://issues.civicrm.org/jira/browse/CRM-10040 & I'll hunt out the various links.

In all cases the domain_id is implicitly the current_domain but an id, an array of ids or 'all' are accepted. I would like this behaviour to be the same across all api
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Settings API
October 08, 2012, 02:50:36 am
Cool!
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Settings API
October 08, 2012, 03:05:33 am
Hi,

That's great! This is what I get with the api explorer

Code: [Select]
{
"is_error":0,
"undefined_fields":["domain_id"],
"version":3,
"count":1,
"id":1,
"values":[{
"is_enabled":"0",
"domain_group_id":"0",
"event_price_set_domain_id":"0",
"uniq_email_per_site":"0",
"tag_unconfirmed":"Unconfirmed",
"petition_contacts":"Petition Contacts",
"contact_view_options":["1","2","3","4","5","6","7","8","9","10","11","13"],
"contact_edit_options":["1","2","3","4","5","6","7","8","9","10","11"],
"advanced_search_options":["1","2","3","4","5","6","7","8","9","10","11","12","13","15","16","17","18","19"],
"user_dashboard_options":["1","2","3","4","5","7","8"],
"address_options":["1","2","3","4","5","6","8","9","10","11"],
"address_format":"{contact.address_name}\n{contact.street_address}\n{contact.supplemental_address_1}\n{contact.supplemental_address_2}\n{contact.city}{, }{contact.state_province}{ }{contact.postal_code}\n{contact.country}",
"mailing_format":"{contact.addressee}\n{contact.street_address}\n{contact.supplemental_address_1}\n{contact.supplemental_address_2}\n{contact.city}{, }{contact.state_province}{ }{contact.postal_code}\n{contact.country}",
"display_name_format":"{contact.individual_prefix}{ }{contact.first_name}{ }{contact.last_name}{ }{contact.individual_suffix}",
"sort_name_format":"{contact.last_name}{, }{contact.first_name}",
"editor_id":"2",
"contact_ajax_check_similar":"1",
"activity_assignee_notification":"1",
"contact_autocomplete_options":["1","2"],
"contact_reference_options":["1","2"],
"enable_cart":"0",
"profile_double_optin":"1",
"track_civimail_replies":"0",
"civimail_workflow":"0",
"civimail_server_wide_lock":"0",
"mailing_backend":{
"outBound_option":"3"
},
"profile_add_to_group_double_optin":"0",
"uploadDir":"upload\/",
"imageUploadDir":"persist\/contribute\/",
"customFileUploadDir":"custom\/",
"extensionsDir":"\/var\/www\/civi.custom\/extensions"
}],

Some are booleans but set as strings. Is this something missing in the xml/definitions or something weird in the ajax api?
eg. "is_enabled": "0" //instead  of :=


Some of the syntax is close to the machine, eg.

Code: [Select]
"advanced_search_options":["1","2","3","4","5","6","7","8","9","10","11","12","13","15","16","17","18","19"],

Is there a way to know what these indexes represent (or translate them by something easier to use?)
$
X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Settings API
October 08, 2012, 03:10:51 am
And on the getfields:


Code: [Select]
{
"is_error":0,
"version":3,
"count":42,
"values":[{
"group_name":"UrlPreferences",
"name":"userFrameworkResourceURL",
"type":"String",
"add":"4.1",
"is_domain":"1",
"is_contact":"0",
"description":"CiviCRM Resource URL",
"validate_callback":"CRM_Utils_Rule::url"
},
{
"group_name":"UrlPreferences",
"name":"imageUploadURL",
"type":"String",
"add":"4.1",
"is_domain":"1",
"is_contact":"0",
"description":"Image Upload URL",
"validate_callback":"CRM_Utils_Rule::url"
},
{
"group_name":"UrlPreferences",
"name":"customCSSURL",
"type":"String",
"add":"4.1",
"is_domain":"1",
"is_contact":"0",
"description":"Custom CiviCRM CSS URL",
"validate_callback":"CRM_Utils_Rule::url"
},
{
"group_name":"Member Preferences",
"name":"default_renewal_contribution_page",
"type":"Integer",
"html_type":"Select",
"pseudoconstant":{
"name":"contributionPage"
},
"add":"4.1",
"title":"Default online membership renewal page",
"is_domain":"1",
"is_contact":"0",
"description":"If you select a default online contribution page for self-service membership renewals, a \"renew\" link pointing to that page will be displayed on the Contact Dashboard for memberships which were entered offline. You will need to ensure that the membership block for the selected online contribution page includes any currently available memberships."
},
{
"group_name":"Multi Site Preferences",
"name":"is_enabled",
"type":"Integer",
"add":"4.1",
"is_domain":"1",
"is_contact":"0",
"description":"Multisite is enabled"
},
{
"group_name":"Multi Site Preferences",
"name":"domain_group_id",
"type":"Integer",
"add":"4.1",
"is_domain":"1",
"is_contact":"0",
"description":"Image Upload URL"
},
{
"group_name":"Multi Site Preferences",
"name":"event_price_set_domain_id",
"type":"Integer",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"Multi Site Preferences",
"name":"uniq_email_per_site",
"type":"Integer",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"Address Standardization Preferences",
"name":"address_standardization_provider",
"type":"String",
"html_type":"Select",
"add":"4.1",
"title":"Address Standardization Provider.",
"is_domain":"1",
"is_contact":"0",
"help_text":"CiviCRM includes an optional plugin for interfacing with the United States Postal Services (USPS) Address Standardization web service. You must register to use the USPS service at https:\/\/www.usps.com\/business\/webtools-address-information.htm. If you are approved, they will provide you with a User ID and the URL for the service. Plugins for other address standardization services may be available from 3rd party developers. If installed, they will be included in the drop-down below. "
},
{
"group_name":"Address Standardization Preferences",
"name":"address_standardization_userid",
"type":"String",
"html_type":"Text",
"add":"4.1",
"title":"Web service user ID..",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"Address Standardization Preferences",
"name":"address_standardization_url",
"type":"Text",
"html_type":"Text",
"add":"4.1",
"title":"Web service user ID..",
"is_domain":"1",
"is_contact":"0",
"help_text":"Web service URL.",
"validate_callback":"CRM_Utils_Rule::url"
},
{
"group_name":"Campaign Preferences",
"name":"tag_unconfirmed",
"type":"String",
"html_type":"Text",
"default":"Unconfirmed",
"add":"4.1",
"title":"Tag for Unconfirmed Petition Signers",
"is_domain":"1",
"is_contact":"0",
"help_text":"If set, new contacts that are created when signing a petition are assigned a tag of this name."
},
{
"group_name":"Campaign Preferences",
"name":"petition_contacts",
"type":"String",
"html_type":"Text",
"default":"Petition Contacts",
"add":"4.1",
"title":"Petition Signers Group",
"is_domain":"1",
"is_contact":"0",
"help_text":"If set, new contacts that are created when signing a petition are assigned a tag of this name."
},
{
"group_name":"CiviCRM Preferences",
"name":"contact_view_options",
"type":"String",
"html_type":"Checkboxes",
"add":"4.1",
"title":"Tag for Unconfirmed Petition Signers",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"CiviCRM Preferences",
"name":"contact_edit_options",
"type":"String",
"html_type":"Text",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"CiviCRM Preferences",
"name":"advanced_search_options",
"type":"String",
"html_type":"Text",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"CiviCRM Preferences",
"name":"user_dashboard_options",
"type":"String",
"html_type":"Text",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"CiviCRM Preferences",
"name":"address_options",
"type":"String",
"html_type":"Text",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"CiviCRM Preferences",
"name":"address_format",
"type":"String",
"html_type":"Text",
"default":"{contact.address_name}\\n{contact.street_address}\\n{contact.supplemental_address_1}\\n{contact.supplemental_address_2}\\n{contact.city}{, }{contact.state_province}{ }{contact.postal_code}\\n{contact.country}",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"CiviCRM Preferences",
"name":"mailing_format",
"type":"String",
"html_type":"Text",
"default":"{contact.addressee}\\n{contact.street_address}\\n{contact.supplemental_address_1}\\n{contact.supplemental_address_2}\\n{contact.city}{, }{contact.state_province}{ }{contact.postal_code}\\n{contact.country}",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"CiviCRM Preferences",
"name":"display_name_format",
"type":"String",
"html_type":"Text",
"default":"{contact.individual_prefix}{ }{contact.first_name}{ }{contact.last_name}{ }{contact.individual_suffix}",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"CiviCRM Preferences",
"name":"sort_name_format",
"type":"String",
"html_type":"Text",
"default":"{contact.last_name}{, }{contact.first_name}",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"CiviCRM Preferences",
"name":"editor_id",
"type":"String",
"html_type":"Text",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"CiviCRM Preferences",
"name":"contact_ajax_check_similar",
"type":"String",
"html_type":"Text",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"CiviCRM Preferences",
"name":"activity_assignee_notification",
"type":"String",
"html_type":"Text",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"CiviCRM Preferences",
"name":"contact_autocomplete_options",
"type":"String",
"html_type":"Text",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"CiviCRM Preferences",
"name":"contact_reference_options",
"type":"String",
"html_type":"Text",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"Event Preferences",
"name":"enable_cart",
"type":"String",
"html_type":"Text",
"add":"4.1",
"title":"Tag for Unconfirmed Petition Signers",
"is_domain":"1",
"is_contact":"0",
"help_text":"If set, new contacts that are created when signing a petition are assigned a tag of this name."
},
{
"group_name":"Mailing Preferences",
"name":"profile_double_optin",
"type":"Integer",
"html_type":"checkbox",
"default":"0",
"add":"4.1",
"title":"Enable Double Opt-in for Profile Group(s) field",
"is_domain":"1",
"is_contact":"0",
"description":"When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group."
},
{
"group_name":"Mailing Preferences",
"name":"track_civimail_replies",
"type":"Integer",
"html_type":"checkbox",
"default":"0",
"add":"4.1",
"title":"Enable Double Opt-in for Profile Group(s) field",
"is_domain":"1",
"is_contact":"0",
"description":"When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.",
"validate_callback":"CRM_Core_BAO_Setting::validateBoolSetting"
},
{
"group_name":"Mailing Preferences",
"name":"civimail_workflow",
"type":"Integer",
"html_type":"checkbox",
"default":"0",
"add":"4.1",
"title":"Enable Double Opt-in for Profile Group(s) field",
"is_domain":"1",
"is_contact":"0",
"description":"When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group."
},
{
"group_name":"Mailing Preferences",
"name":"civimail_server_wide_lock",
"type":"Integer",
"html_type":"checkbox",
"default":"0",
"add":"4.1",
"title":"Enable Double Opt-in for Profile Group(s) field",
"is_domain":"1",
"is_contact":"0",
"description":"When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group."
},
{
"group_name":"Mailing Preferences",
"name":"mailing_backend",
"type":"Array",
"html_type":"checkbox",
"default":"0",
"add":"4.1",
"title":"Enable Double Opt-in for Profile Group(s) field",
"is_domain":"1",
"is_contact":"0",
"description":"When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group."
},
{
"group_name":"Mailing Preferences",
"name":"profile_add_to_group_double_optin",
"type":"Integer",
"html_type":"checkbox",
"default":"0",
"add":"4.1",
"title":"Enable Double Opt-in for Profile Group(s) field",
"is_domain":"1",
"is_contact":"0",
"description":"When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group."
},
{
"group_name":"Directory Preferences",
"name":"uploadDir",
"type":"Url",
"html_type":"Text",
"add":"4.1",
"is_domain":"1",
"is_contact":"0",
"help_text":"If set, new contacts that are created when signing a petition are assigned a tag of this name."
},
{
"group_name":"Directory Preferences",
"name":"imageUploadDir",
"type":"Url",
"html_type":"Text",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"Directory Preferences",
"name":"customFileUploadDir",
"type":"Url",
"html_type":"Text",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"Directory Preferences",
"name":"customTemplateDir",
"type":"Url",
"html_type":"Text",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"Directory Preferences",
"name":"customPHPPathDir",
"type":"Url",
"html_type":"Text",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"group_name":"Directory Preferences",
"name":"extensionsDir",
"type":"Url",
"html_type":"Text",
"add":"4.1",
"is_domain":"1",
"is_contact":"0"
},
{
"title":"Fields you wish to filter by e.g. array(\"group_name\" => \"CiviCRM Preferences\")"
},
{
"title":"id of relevant component"
}],

We did discuss the localisation issues (language/currency/countries...) but I don't see them in that list. Is this already there but I need to do something to see/enable them?

The group_name is already there on the the fields definition,  is there an option to group the fields by this on the get? Might be easier to read?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Settings API
October 08, 2012, 04:23:54 am
Hey there,

That looks cool.  Stupid / obvious question.  Is one of the use cases for this initial installation set up of CiviCRM.  And do you have any ideas on how that might work? / suggestions on how that could be implemented.

Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Settings API
October 08, 2012, 06:36:48 am
Making it easier for the initial install is a big use case.

We discussed about what format (xml...) it could be, and decided to focus on the underlying "primitive" api calls. Might be worthwhile revisiting when we know all the calls and got a bit more experience.

So the "init script" can be either a php full of civicrm_api ('setting'....

or you can use a tiny wrapper to take the data from a csv or xml or whatever and call the api.

IMO, php code is the most flexible and arguably easier to read/understand than xml (at least with my editor)

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Settings API
October 08, 2012, 01:55:44 pm
Hi Michael,

The idea for installation is that you can use the settings api to set various things. Or you can define the defaults for your country (or whatever) and then 'revert' to them. What would be good to compile is a list of standard changes that you (or someone) makes when configuring a site to see how it maps against it.

Ideally at some point we would make the initial settings load based on the defaults (which are potentially hook-modified) rather than 'hard-sql'. Also I think the domain create action should 'fill' settings (@ the moment it doesn't create any at all).

Xavier,

1) I am fairly  agnostic about the storage format. I think I copied the use of xml based on that being in place for schema.
2) Looking at your output the getfields array doesn't seem to be keyed by the setting name which seems like a bug.
3) CiviCRM is already stored integers as strings in the settings table - that's what you are seeing. Probably should be fixed but not necessarily in the scope of this.
4) language/currency/countries... If these aren't in the list they are probably still stored in the civicrm_domain table. They should be moved. I think most will be fairly simple but ...
5) the handling of allowed states / countries need some thought - the current method is memory intensive. We could save the array as json in the settings table & unserialise it / use only when there is a country box. But there are other problems with the current method - e.g people like to restrict front end country entry - but then they can't even see the country for imported contacts from a non-permitted country. So, would be good to be clear firstly (because I'm not) what we expect from the country / state list restriction & then potentially look at how to store that.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Settings API
October 08, 2012, 03:12:43 pm
Quote from: Eileen on October 08, 2012, 01:55:44 pm

2) Looking at your output the getfields array doesn't seem to be keyed by the setting name which seems like a bug.

That was with sequential=1, the name is the key otherwise indeed

Quote from: Eileen on October 08, 2012, 01:55:44 pm
3) CiviCRM is already stored integers as strings in the settings table - that's what you are seeing. Probably should be fixed but not necessarily in the scope of this.

ok

Quote from: Eileen on October 08, 2012, 01:55:44 pm
4) language/currency/countries... If these aren't in the list they are probably still stored in the civicrm_domain table. They should be moved. I think most will be fairly simple but ..
5) the handling of allowed states / countries need some thought - the current method is memory intensive. We could save the array as json in the settings table & unserialise it / use only when there is a country box. But there are other problems with the current method - e.g people like to restrict front end country entry - but then they can't even see the country for imported contacts from a non-permitted country. So, would be good to be clear firstly (because I'm not) what we expect from the country / state list restriction & then potentially look at how to store that.

Ah, ok. Might be better moving that discussion to another tread. anyway:

Shouldn't is simply be a new column "is_active" in the country table? and then using the "normal" pseudoconstant cache feature on it and leave all that outside of the setting table?

Probably needs as well a UI, that wouldn't hurt anyway if folks want to change the name of a country (had a request today to rename "Palestine, occupied territory" into "palestine" and indeed, some of the official names for countries are quite verbose.

I didn't have a use case of different countries for the front or back. I did have the case of different countries per profile.


-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Settings API
October 08, 2012, 03:21:21 pm
Ok separate thread for the counrty list stuff since I can see it over-taking this thread
http://forum.civicrm.org/index.php/topic,26348.0.html
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Settings API
October 09, 2012, 01:49:45 am
Cool. I wonder if Antrik is interested in experimenting with this stuff.  I think an admin screen that allows you to diff against a installation profiles, e.g. default, UK, campaigning organisation would be useful, and allows you to apply changes on a setting by setting basis would be super nice.

Happy to help out with that.
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

JoeMurray

  • Administrator
  • Ask me questions
  • *****
  • Posts: 578
  • Karma: 24
    • JMA Consulting
  • CiviCRM version: 4.4 and 4.5 (as of Nov 2014)
  • CMS version: Drupal, WordPress, Joomla
  • MySQL version: MySQL 5.5, 5.6, MariaDB 10.0 (as of Nov 2014)
Re: Settings API
October 09, 2012, 07:02:36 am
Thanks, Eileen, this is really moving along nicely now.

Michael: yes, the primary use case I had for sponsoring this was to allow auto-configuration of CiviCRM installations, eg from a drush script, etc. Ideally, this would make it possible to do something along the lines of a Drupal install profile.
Co-author of Using CiviCRM https://www.packtpub.com/using-civicrm/book

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Settings API
October 09, 2012, 11:45:43 am
Joe / others reading - it would be great if someone could compile a list of the things they usually change so I can focus on those settings. (I found the whole settings definition pretty exhausting so I went for a get-em-in-quick & tidy up after approach)
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Settings API
October 10, 2012, 11:13:01 am
Quote from: Eileen on October 09, 2012, 11:45:43 am
Joe / others reading - it would be great if someone could compile a list of the things they usually change so I can focus on those settings. (I found the whole settings definition pretty exhausting so I went for a get-em-in-quick & tidy up after approach)

This isn't really an answer, but I can think of three distinct use-cases for "configuration bundles", and each would seem to gravitate towards different settings:
 * Localization (address format, currency, language, etc -- shared by sites in the same locale)
 * Service configuration (email routing, SMS, payment processing, etc -- shared by sites with the same hosting provider)
 * Usability improvements (enabling/disabling components, blocks, navigation items, default permissions, etc -- shared by sites in similar niches)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Settings API
October 10, 2012, 01:11:35 pm
I kind of wish you hadn't said that. I was looking for people to say "I always customise these really simple things that are already stored as settings"

Looks like I'll have to tackle getting localisation out of the config object into settings sooner rather than later. I think I can stall on the country limit stuff a bit longer though (at least until I have a clearer idea how it should look http://forum.civicrm.org/index.php/topic,26348.0.html)
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Settings API
October 10, 2012, 07:14:03 pm
OK, I moved a whopping 1 setting from config to civicrm_settings & made the observation that it will be necessary for svn devs / upgrade scripts to

1) clear the civicrm_cache table &
2) run civicrm_api('setting','fill', array('version' => 3);

to not lose functionality.

(since I don't want to go around putting the default into the getitem calls).

I guess these 2 should be done by all upgrade scripts + the setup script for svn users
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1] 2 3 4
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Settings API

This forum was archived on 2017-11-26.