Answers.Body: <p>Calling <code>CRM_Core_BAO_ConfigSetting::enableComponent(&quot;CiviCase&quot;);</code> will enable it if not enabled already.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-28T02:34:42.753Z
Answers.Text: Hi @Binary Alchemist, the way stackexchange displays review+edit comments is bizarre. I saw your suggested edit, and accepted part of it but not the addition of the extra `if` check because the function won't do anything if it's already enabled.
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-19T18:16:38.410Z
Answers.LastActivityDate: 2023-03-28T01:26:26.020Z
Answers.LastEditDate: 2023-03-28T01:26:26.020Z
Answers.UserDisplayName: Demerit
Body: <p>I am working with CiviCRM 5.59.3, and a drupal module that integrates with CiviCase. How can I check if the CiviCRM component is enabled and enable it if it is disabled? I need to do this with php.</p>
  
Tags: <drupal><civicase><drupal-9>
Title: Enable CiviCase component programatically
ThreadText: # Enable CiviCase component programatically
  
  (Asked by: username_0 on 2023-03-19)
  
  I am working with CiviCRM 5.59.3, and a drupal module that integrates with CiviCase. How can I check if the CiviCRM component is enabled and enable it if it is disabled? I need to do this with php.
  
  **Tags:** drupal, civicase, drupal-9
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-03-19. Score: 3
  
  Calling `CRM_Core_BAO_ConfigSetting::enableComponent("CiviCase");` will enable it if not enabled already.
  
  > **Comments:**
  > **username_1**: Hi @username_0, the way stackexchange displays review+edit comments is bizarre. I saw your suggested edit, and accepted part of it but not the addition of the extra `if` check because the function won't do anything if it's already enabled.  
  
  ---
  
  