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) »
  • Disabling Components via API / PHP ?
Pages: [1]

Author Topic: Disabling Components via API / PHP ?  (Read 936 times)

Luciano S.

  • I post occasionally
  • **
  • Posts: 83
  • Karma: 2
  • iXiam Team Leader
  • CiviCRM version: 4.2+ / 4.3+ / 4.4+
  • CMS version: Drupal
  • MySQL version: 5.1+ / 5.5+
  • PHP version: 5.3+ / 5.4+
Disabling Components via API / PHP ?
May 31, 2013, 08:08:43 am
Hi guys,

using CiviCRM 4.3.3 I want to disable some Civi Components when installing an extension.
Is it possible to do it with API ? I don't know how far the new Settings/API feature gets, but I didn't see any option for Components.

If cannot be achieved using API, anyone has done it using Core Classes?

cheers!

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: Disabling Components via API / PHP ?
June 03, 2013, 03:23:26 am
What version of CiviCRM are you using? You should have a Settings API, not sure if you can enable components with it though....check with Eileen? She has kept a wiki page:
http://wiki.civicrm.org/confluence/display/CRM/API+for+Settings

If not, you can use CRM_Core_BAO_ConfigSetting::enableComponent?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Luciano S.

  • I post occasionally
  • **
  • Posts: 83
  • Karma: 2
  • iXiam Team Leader
  • CiviCRM version: 4.2+ / 4.3+ / 4.4+
  • CMS version: Drupal
  • MySQL version: 5.1+ / 5.5+
  • PHP version: 5.3+ / 5.4+
Re: Disabling Components via API / PHP ?
June 03, 2013, 04:02:54 am
I'm using latest version 4.3.3. As far as I researched, is not yet implemented.
Task ID 2, from the list you provided the URL

Add enable / disable action for components

Code: [Select]
civicrm_api('setting', create'

? some fixing / metadata still required here

I see CRM_Core_BAO_ConfigSetting::enableComponent, but I don't see what I need disableComponents

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: Disabling Components via API / PHP ?
June 03, 2013, 04:52:26 am
I did not see it either :-)
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: Disabling Components via API / PHP ?
June 03, 2013, 05:59:32 am
Hey,

You are in europe right? What about you come to the sprint in south of France and we add the api to handle that?

http://civicrm.org/civicrm/event/info?reset=1&id=301

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

Deepak Srivastava

  • Ask me questions
  • ****
  • Posts: 677
  • Karma: 65
Re: Disabling Components via API / PHP ?
June 18, 2013, 12:04:18 am
As a quick work around this is how we did it for civihr - https://github.com/civicrm/civihr/pull/14 for http://issues.civicrm.org/jira/browse/CRM-12805.

Currently this can't be done using settings api as the setting is stored in config_backend. Have filed a new ticket for exposing it to settings api - http://issues.civicrm.org/jira/browse/CRM-12846.

Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

Luciano S.

  • I post occasionally
  • **
  • Posts: 83
  • Karma: 2
  • iXiam Team Leader
  • CiviCRM version: 4.2+ / 4.3+ / 4.4+
  • CMS version: Drupal
  • MySQL version: 5.1+ / 5.5+
  • PHP version: 5.3+ / 5.4+
Re: Disabling Components via API / PHP ?
June 21, 2013, 09:38:26 am
Tx Deepak,

I've ended up doing a similar solution.
Nice to have in next API releases

cheers!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Disabling Components via API / PHP ?

This forum was archived on 2017-11-26.