Merge pull request #12797 from madhavimalgaonkar/CRM-287
[civicrm-core.git] / Civi.php
index d535e1afbd066791c363f02131e3499ff65ce014..ee6138c9845683ced0629b8b0e357f1d8a0c3dd1 100644 (file)
--- a/Civi.php
+++ b/Civi.php
@@ -117,6 +117,22 @@ class Civi {
     return CRM_Core_Resources::singleton();
   }
 
+  /**
+   * Obtain the contact's personal settings.
+   *
+   * @param NULL|int $contactID
+   *   For the default/active user's contact, leave $domainID as NULL.
+   * @param NULL|int $domainID
+   *   For the default domain, leave $domainID as NULL.
+   * @return \Civi\Core\SettingsBag
+   * @throws CRM_Core_Exception
+   *   If there is no contact, then there's no SettingsBag, and we'll throw
+   *   an exception.
+   */
+  public static function contactSettings($contactID = NULL, $domainID = NULL) {
+    return \Civi\Core\Container::getBootService('settings_manager')->getBagByContact($domainID, $contactID);
+  }
+
   /**
    * Obtain the domain settings.
    *