CRM_Core_PseudoConstant
class CRM_Core_PseudoConstant
Stores all constants and pseudo constants for CRM application.
examples of constants are "Contact Type" which will always be either 'Individual', 'Household', 'Organization'.
pseudo constants are entities from the database whose values rarely change. examples are list of countries, states, location types, relationship types.
currently we're getting the data from the underlying database. this will be reworked to use caching.
Note: All pseudoconstants should be uninitialized or default to NULL. This provides greater consistency/predictability after flushing.
Methods
Low-level option getter, rarely accessed directly.
Fetch the translated label for a field given its key.
Fetch the machine name for a field given its key.
Fetch the key for a field option given its name.
Lookup the admin page at which a field's option list can be edited
DEPRECATED generic populate method.
Flush given pseudoconstant so it can be reread from db.
Get all the State/Province from database.
Get all the State/Province abbreviations from the database.
Get all the countries from database.
Get all the country ISO Code abbreviations from the database.
Get all permissioned groups from database.
Fetch groups in a nested format suitable for use in select form element.
Get all permissioned groups from database.
Get all Relationship Types from database.
Get all the ISO 4217 currency codes
Get all the County from database.
No description
No description
Get all the World Regions from Database.
No description
No description
Given a state ID return the country ID, this allows us to populate forms and values for downstream code
Get all types of Greetings.
Construct array of default greeting values for contact type.
Get all extensions.
Get all options values.
Fetch the list of active extensions of type 'module'
Get all tax rates.
Details
at line 206
static array|bool
get(string $daoName, string $fieldName, array $params = array(), string $context = NULL)
Low-level option getter, rarely accessed directly.
NOTE: Rather than calling this function directly use CRM_BAO::buildOptions()
at line 430
static bool|null|string
getLabel(string $baoName, string $fieldName, string|Int $key)
Fetch the translated label for a field given its key.
at line 450
static bool|null|string
getName(string $baoName, string $fieldName, string|Int $key)
Fetch the machine name for a field given its key.
at line 470
static bool|null|string|int
getKey(string $baoName, string $fieldName, string|Int $value)
Fetch the key for a field option given its name.
at line 483
static string|null
getOptionEditUrl($fieldSpec)
Lookup the admin page at which a field's option list can be edited
at line 533
static array
populate(array $var, string $name, bool $all = FALSE, string $retrieve = 'name', string $filter = 'is_active', string $condition = NULL, bool $orderby = NULL, string $key = 'id', bool $force = NULL)
DEPRECATED generic populate method.
All pseudoconstant functions that use this method are also @deprecated
The static array $var is populated from the db using the $name DAO.
Note: any database errors will be trapped by the DAO.
at line 591
static
flush(bool|string $name = 'cache')
Flush given pseudoconstant so it can be reread from db.
nex time it's requested.
at line 611
static array
activityType()
deprecated
deprecated
at line 689
static array
stateProvince(bool|int $id = FALSE, bool $limit = TRUE)
Get all the State/Province from database.
The static array stateProvince is returned, and if it's called the first time, the State Province DAO is used to get all the States.
Note: any database errors will be trapped by the DAO.
at line 743
static array
stateProvinceAbbreviation(bool|int $id = FALSE, bool $limit = TRUE)
Get all the State/Province abbreviations from the database.
Same as above, except gets the abbreviations instead of the names.
at line 800
static array|null
country(bool|int $id = FALSE, bool $applyLimit = TRUE)
Get all the countries from database.
The static array country is returned, and if it's called the first time, the Country DAO is used to get all the countries.
Note: any database errors will be trapped by the DAO.
at line 875
static array
countryIsoCode(bool $id = FALSE)
Get all the country ISO Code abbreviations from the database.
The static array countryIsoCode is returned, and if it's called the first time, the Country DAO is used to get all the countries' ISO codes.
Note: any database errors will be trapped by the DAO.
at line 910
static array
allGroup(string $groupType = NULL, bool $excludeHidden = TRUE)
deprecated
deprecated
at line 938
static array
group(string $groupType = NULL, bool $excludeHidden = TRUE)
Get all permissioned groups from database.
The static array group is returned, and if it's called the first time, the Group DAO is used to get all the groups.
Note: any database errors will be trapped by the DAO.
at line 949
static array
nestedGroup(bool $checkPermissions = TRUE, string|null $groupType = NULL, bool $excludeHidden = TRUE)
Fetch groups in a nested format suitable for use in select form element.
at line 971
static array
staticGroup(bool $onlyPublic = FALSE, null $groupType = NULL, bool $excludeHidden = TRUE)
Get all permissioned groups from database.
The static array group is returned, and if it's called the first time, the Group DAO is used to get all the groups.
Note: any database errors will be trapped by the DAO.
at line 1011
static array
relationshipType(string $valueColumnName = 'label', bool $reset = FALSE, bool $isActive = 1)
Get all Relationship Types from database.
The static array group is returned, and if it's called the first time, the RelationshipType DAO is used to get all the relationship types.
Note: any database errors will be trapped by the DAO.
at line 1053
static array
currencyCode()
Get all the ISO 4217 currency codes
so far, we use this for validation only, so there's no point of putting this into the database
at line 1343
static array
county(bool|int $id = FALSE)
Get all the County from database.
The static array county is returned, and if it's called the first time, the County DAO is used to get all the Counties.
Note: any database errors will be trapped by the DAO.
at line 1378
static array
paymentProcessor(bool $all = FALSE, bool $test = FALSE, null $additionalCond = NULL)
deprecated
deprecated
at line 1413
static array
paymentProcessorType(bool $all = FALSE, int $id = NULL, string $return = 'title')
deprecated
deprecated
at line 1433
static array
worldRegion(bool $id = FALSE)
Get all the World Regions from Database.
at line 1463
static array
activityStatus(string $column = 'label')
deprecated
deprecated
at line 1489
static array
visibility(string $column = 'label')
deprecated
deprecated
at line 1507
static array
stateProvinceForCountry(int $countryID, string $field = 'name')
at line 1561
static array
countyForState(int $stateID)
at line 1623
static int|null
countryIDForStateID(int $stateID)
Given a state ID return the country ID, this allows us to populate forms and values for downstream code
at line 1652
static array
greeting($filter, string $columnName = 'label')
Get all types of Greetings.
The static array of greeting is returned
at line 1698
static array
greetingDefaults()
Construct array of default greeting values for contact type.
at line 1733
static array
getExtensions()
Get all extensions.
The static array extensions
FIXME: This is called by civix but not by any core code. We should provide an API call which civix can use instead.
at line 1765
static array
accountOptionValues(bool $optionGroupName, int $id = NULL, null $condition = NULL)
Get all options values.
The static array option values is returned
at line 1786
static array
getModuleExtensions(bool $fresh = FALSE)
Fetch the list of active extensions of type 'module'
at line 1799
static array
getTaxRates()
Get all tax rates.
The static array tax rates is returned