Answers.Body: <p>Perhaps another example will help you along:</p>
  
  <p>The Form:
  <a href="https://github.com/jake-mw/CDNTaxReceipts/blob/master/CRM/Cdntaxreceipts/Form/Settings.php" rel="nofollow noreferrer">https://github.com/jake-mw/CDNTaxReceipts/blob/master/CRM/Cdntaxreceipts/Form/Settings.php</a></p>
  
  <p>And some of the settings are retrieved here:
  <a href="https://github.com/jake-mw/CDNTaxReceipts/blob/master/cdntaxreceipts.functions.inc#L73" rel="nofollow noreferrer">https://github.com/jake-mw/CDNTaxReceipts/blob/master/cdntaxreceipts.functions.inc#L73</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-02T22:36:26.610Z
Answers.Text: Thanks for the example! I took this route and got it working no problem... It uses a pretty different strategy than the other examples that use an extension.settings.php and the API. Is there any reason you know of that one might be preferred over the other?
Answers.UserDisplayName: Eli Lisseck
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-03T00:50:02.727Z
Answers.Text: Glad that helped you! We wrote that yeara ago - I still use it as my own goto example; I honestly don't know about any other ways to do it
Answers.UserDisplayName: KarinG - Semper IT
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-03T15:32:25.520Z
Answers.Text: Usually the API is preferred because the BAO functions might show different behaviour. But it is no law and it makes sense to at least start with what makes sense to you and move on to other steps once you are comfortable with what you are doing :-)
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-03T17:38:29.777Z
Answers.Text: Thanks @ErikH-CiviCooP - my next settings page will use the API 
Answers.UserDisplayName: KarinG - Semper IT
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-02T19:13:42.853Z
Answers.LastActivityDate: 2017-04-03T00:13:08.103Z
Answers.LastEditDate: 2017-04-03T00:13:08.103Z
Answers.UserDisplayName: KarinG - Semper IT
Body: <p>I would like to add a settings form to a new extension to hold some extension-specific settings.</p>
  
  <p>I've put together the extension and form using civix, and am testing in civiCRM 4.7.17 on local MAMP.</p>
  
  <p>After reading the docs <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference" rel="nofollow noreferrer">here</a> and <a href="https://docs.civicrm.org/dev/en/master/extensions/civix/" rel="nofollow noreferrer">here</a>, i've tried to copy the setup for settings in <a href="https://github.com/eileenmcnaughton/nz.co.fuzion.civixero" rel="nofollow noreferrer">this repo</a> (metadata form example from docs), and also looking at <a href="https://github.com/eileenmcnaughton/org.civicrm.multisite" rel="nofollow noreferrer">this repo</a>.</p>
  
  <p>I've looked at <a href="https://civicrm.stackexchange.com/questions/3458/how-do-i-add-a-new-settings-page-for-my-extension">this question</a>, but the issue i'm having is getting the settings array returned from settings/'myextension'.settings.php to actually populate anywhere in the first place. </p>
  
  <p>For example when installing/enabling the extension, hook_alterSettingsFolders fires with the same code as in the above repos, but if I try to find my settings with the apiv3 call like <a href="https://github.com/eileenmcnaughton/nz.co.fuzion.civixero/blob/master/CRM/Civixero/Form/XeroSettings.php" rel="nofollow noreferrer">this form</a> (the one I used as well) does, the settings group has not been added, and so my form only populates with submit buttons and a var_dump of $_settings is empty.</p>
  
  <p>I'm not seeing anything obvious in the civicrm or php logs.</p>
  
  <p>Is there some key step i'm missing to get civicrm to recognize these settings?</p>
  
  <p>Thanks!</p>
  
Tags: <extension><developer><settings>
Title: Adding settings with form to my extension - what am I missing?
ThreadText: # Adding settings with form to my extension - what am I missing?
  
  (Asked by: username_0 on 2017-04-02)
  
  I would like to add a settings form to a new extension to hold some extension-specific settings.
  
  I've put together the extension and form using civix, and am testing in civiCRM 4.7.17 on local MAMP.
  
  After reading the docs [here](https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference) and [here](https://docs.civicrm.org/dev/en/master/extensions/civix/), i've tried to copy the setup for settings in [this repo](https://github.com/eileenmcnaughton/nz.co.fuzion.civixero) (metadata form example from docs), and also looking at [this repo](https://github.com/eileenmcnaughton/org.civicrm.multisite).
  
  I've looked at [this question](https://civicrm.stackexchange.com/questions/3458/how-do-i-add-a-new-settings-page-for-my-extension), but the issue i'm having is getting the settings array returned from settings/'myextension'.settings.php to actually populate anywhere in the first place.
  
  For example when installing/enabling the extension, hook\_alterSettingsFolders fires with the same code as in the above repos, but if I try to find my settings with the apiv3 call like [this form](https://github.com/eileenmcnaughton/nz.co.fuzion.civixero/blob/master/CRM/Civixero/Form/XeroSettings.php) (the one I used as well) does, the settings group has not been added, and so my form only populates with submit buttons and a var\_dump of $\_settings is empty.
  
  I'm not seeing anything obvious in the civicrm or php logs.
  
  Is there some key step i'm missing to get civicrm to recognize these settings?
  
  Thanks!
  
  **Tags:** extension, developer, settings
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-04-02. Score: 1 | Accepted answer
  
  Perhaps another example will help you along:
  
  The Form:
  <https://github.com/jake-mw/CDNTaxReceipts/blob/master/CRM/Cdntaxreceipts/Form/Settings.php>
  
  And some of the settings are retrieved here:
  <https://github.com/jake-mw/CDNTaxReceipts/blob/master/cdntaxreceipts.functions.inc#L73>
  
  > **Comments:**
  > **username_0**: Thanks for the example! I took this route and got it working no problem... It uses a pretty different strategy than the other examples that use an extension.settings.php and the API. Is there any reason you know of that one might be preferred over the other?  
  > **username_1**: Glad that helped you! We wrote that yeara ago - I still use it as my own goto example; I honestly don't know about any other ways to do it  
  > **username_2**: Usually the API is preferred because the BAO functions might show different behaviour. But it is no law and it makes sense to at least start with what makes sense to you and move on to other steps once you are comfortable with what you are doing :-)  
  > **username_1**: Thanks @ErikH-CiviCooP - my next settings page will use the API   
  
  ---
  
  