X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FPseudoConstant.php;h=06055036670f86751afd901a858fca1fd4a9be3b;hb=f2b53f2699051f6066b579da62b17a939e67119c;hp=d70e769ac62d8c8f24bdbe112d6418d0c4739c8e;hpb=6d68a4cb56cdbe45112853ee0b5ecf15179b057d;p=civicrm-core.git diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index d70e769ac6..0605503667 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -219,6 +219,21 @@ class CRM_Core_PseudoConstant { * @static */ public static function get($daoName, $fieldName, $params = array()) { + $flip = !empty($params['flip']); + + // Custom fields are not in the schema + if (strpos($fieldName, 'custom') === 0) { + $dao = new CRM_Core_DAO_CustomField; + $dao->id = (int) substr($fieldName, 7); + $dao->find(TRUE); + $customField = (array) $dao; + $dao->free(); + $output = array(); + CRM_Core_BAO_CustomField::buildOption($customField, $output); + return $flip ? array_flip($output) : $output; + } + + // Core field: load schema $dao = new $daoName; $fields = $dao->fields(); $fieldKeys = $dao->fieldKeys(); @@ -228,7 +243,6 @@ class CRM_Core_PseudoConstant { return FALSE; } $fieldSpec = $fields[$fieldKey]; - $flip = !empty($params['flip']); // If the field is an enum, explode the enum definition and return the array. if (isset($fieldSpec['enumValues'])) { @@ -1261,6 +1275,7 @@ WHERE id = %1"; } /** + * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. * Get all active payment processors * * The static array paymentProcessor is returned @@ -1295,7 +1310,7 @@ WHERE id = %1"; } /** - * Get all active payment processors + * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. * * The static array paymentProcessorType is returned *