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) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Managing a config variable for an extension
Pages: [1]

Author Topic: Managing a config variable for an extension  (Read 1062 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Managing a config variable for an extension
April 16, 2013, 02:56:34 pm
So for an extension, I need to be able to have different values for different site.
What's the preferred way of doing that (I don't need a UI)? I wanted to

Put in the civicrm.setting.php
Code: [Select]
global $civicrm_setting;
$civicrm_setting['eu.tttp.myextension']['color'] = "pink";


and use normally the $config = CRM_Core_Config::singleton()

(obviously, if the variable isn't set, default to a sane option).


Is this the best practice? You have something more future proof to suggest?

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: Managing a config variable for an extension
April 16, 2013, 07:51:00 pm
The direction I was trying was per

https://github.com/eileenmcnaughton/org.civicrm.multisite/blob/master/multisite.civix.php

which then means you can set it using drush / api / setting.create

You'll see the setting is defined in a directory. Of course - I have backported various bits of 4.3 to our fuzion 4.2 so this wouldn't necessarily work on 4.2
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: Managing a config variable for an extension
April 17, 2013, 01:45:09 am
Hi,

http://wiki.civicrm.org/confluence/display/CRMDOC43/hook_civicrm_alterSettingsFolders

Ok, so you can change the setting folder, but what are you supposed to put in the new setting folder? How does it work? Do you have an example/how to how that's done?

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: Managing a config variable for an extension
April 22, 2013, 07:32:41 pm
https://github.com/eileenmcnaughton/org.civicrm.multisite/tree/master/settings
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]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Managing a config variable for an extension

This forum was archived on 2017-11-26.