CRM_Member_PseudoConstant
extends CRM_Core_PseudoConstant
in package
This class holds all the Pseudo constants that are specific to the civimember component. This avoids polluting the core class and isolates the mass mailer class
Table of Contents
Properties
- $accountOptionValues : array<string|int, mixed>
- Financial Account Type
- $activityType : array<string|int, mixed>
- activity type
- $cache : array<string|int, mixed>
- Static cache for pseudoconstant arrays.
- $country : array<string|int, mixed>
- Country.
- $county : array<string|int, mixed>
- Counties.
- $currencyCode : array<string|int, mixed>
- Currency codes
- $extensions : array<string|int, mixed>
- Extensions of type module
- $group : array<string|int, mixed>
- group
- $membershipStatus : array<string|int, mixed>
- Membership types.
- $membershipType : array<string|int, mixed>
- Membership types.
- $relationshipType : array<string|int, mixed>
- RelationshipType
- $stateProvince : array<string|int, mixed>
- States, provinces
- $stateProvinceAbbreviation : array<string|int, mixed>
- States/provinces abbreviations
- $staticGroup : array<string|int, mixed>
- Civicrm groups that are not smart groups
Methods
- accountOptionValues() : array<string|int, mixed>
- Get all options values.
- activityStatus() : array<string|int, mixed>
- activityType() : array<string|int, mixed>
- allGroup() : array<string|int, mixed>
- country() : array<string|int, mixed>|null
- Get all the countries from database.
- countryIDForStateID() : int|null
- Given a state ID return the country ID, this allows us to populate forms and values for downstream code
- countryIsoCode() : array<string|int, mixed>
- Get all the country ISO Code abbreviations from the database.
- county() : array<string|int, mixed>
- Get all the County from database.
- countyForState() : array<string|int, mixed>
- currencyCode() : array<string|int, mixed>
- Get all the ISO 4217 currency codes
- emailOnHoldOptions() : array<string|int, mixed>
- Get participant status class options.
- flush() : mixed
- Flush given pseudoconstant so it can be reread from db next time it's requested.
- formatArrayOptions() : array<string|int, mixed>
- Convert multidimensional option list to flat array, if necessary
- get() : array<string|int, mixed>|bool
- Legacy option getter.
- getExtensions() : array<string|int, mixed>
- Get all extensions.
- getKey() : bool|null|string|int
- Fetch the key for a field option given its name.
- getLabel() : bool|null|string
- Fetch the translated label for a field given its key.
- getModuleExtensions() : array<string|int, mixed>
- Fetch the list of active extensions of type 'module'
- getName() : bool|null|string
- Fetch the machine name for a field given its key.
- getOptionEditUrl() : string|null
- Lookup the admin page at which a field's option list can be edited
- getTaxRates() : array<string|int, mixed>
- Get all tax rates.
- greeting() : array<string|int, mixed>
- Get all types of Greetings.
- group() : array<string|int, mixed>
- Get all permissioned groups from database.
- membershipStatus() : array<string|int, mixed>
- Get all the membership statuss.
- membershipType() : array<string|int, mixed>
- Get all the membership types.
- nestedGroup() : array<string|int, mixed>
- Fetch groups in a nested format suitable for use in select form element.
- paymentProcessor() : array<string|int, mixed>
- paymentProcessorType() : array<string|int, mixed>
- populate() : array<string|int, mixed>
- relationshipType() : array<string|int, mixed>
- Get all Relationship Types from database.
- relationshipTypeOptions() : array<string|int, mixed>
- Name => Label pairs for all relationship types
- renderOptionsFromTablePseudoconstant() : array<string|int, mixed>|bool|mixed
- Render the field options from the available pseudoconstant.
- stateProvince() : array<string|int, mixed>
- Get all the State/Province from database.
- stateProvinceAbbreviation() : array<string|int, mixed>
- Get all the State/Province abbreviations from the database.
- stateProvinceAbbreviationForCountry() : array<string|int, mixed>
- Get all the State/Province abbreviations from the database for the specified country.
- stateProvinceAbbreviationForDefaultCountry() : array<string|int, mixed>
- Get all the State/Province abbreviations from the database for the default country.
- stateProvinceForCountry() : array<string|int, mixed>
- staticGroup() : array<string|int, mixed>
- Get all permissioned groups from database.
- visibility() : array<string|int, mixed>
- worldRegion() : array<string|int, mixed>
- Get all the World Regions from Database.
Properties
$accountOptionValues
Financial Account Type
private
static array<string|int, mixed>
$accountOptionValues
$activityType
activity type
Please use the buildOptions() method in the appropriate BAO object.
private
static array<string|int, mixed>
$activityType
$cache
Static cache for pseudoconstant arrays.
private
static array<string|int, mixed>
$cache
$country
Country.
private
static array<string|int, mixed>
$country
$county
Counties.
private
static array<string|int, mixed>
$county
$currencyCode
Currency codes
private
static array<string|int, mixed>
$currencyCode
$extensions
Extensions of type module
private
static array<string|int, mixed>
$extensions
$group
group
Please use the buildOptions() method in the appropriate BAO object.
private
static array<string|int, mixed>
$group
$membershipStatus
Membership types.
private
static array<string|int, mixed>
$membershipStatus
$membershipType
Membership types.
private
static array<string|int, mixed>
$membershipType
$relationshipType
RelationshipType
private
static array<string|int, mixed>
$relationshipType
= []
$stateProvince
States, provinces
private
static array<string|int, mixed>
$stateProvince
$stateProvinceAbbreviation
States/provinces abbreviations
private
static array<string|int, mixed>
$stateProvinceAbbreviation
= []
$staticGroup
Civicrm groups that are not smart groups
private
static array<string|int, mixed>
$staticGroup
Methods
accountOptionValues()
Get all options values.
public
static accountOptionValues(string $optionGroupName[, int $id = NULL ][, string $condition = NULL ][, string $column = 'label' ]) : array<string|int, mixed>
The static array option values is returned
Parameters
- $optionGroupName : string
-
Name of option group
- $id : int = NULL
- $condition : string = NULL
- $column : string = 'label'
-
Whether to return 'name' or 'label'
Return values
array<string|int, mixed> —array reference of all Option Values
activityStatus()
public
static & activityStatus([string $column = 'label' ]) : array<string|int, mixed>
Please use the buildOptions() method in the appropriate BAO object.
Get all Activity Statuses.
Parameters
- $column : string = 'label'
Return values
array<string|int, mixed>activityType()
public
static & activityType() : array<string|int, mixed>
Please use the buildOptions() method in the appropriate BAO object.
Get all Activty types.
The static array activityType is returned
Return values
array<string|int, mixed> —array reference of all activity types.
allGroup()
public
static allGroup([string $groupType = NULL ][, bool $excludeHidden = TRUE ]) : array<string|int, mixed>
Please use the buildOptions() method in the appropriate BAO object.
Get all 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.
Parameters
- $groupType : string = NULL
-
Type of group(Access/Mailing).
- $excludeHidden : bool = TRUE
-
Exclude hidden groups.
Return values
array<string|int, mixed> —array reference of all groups.
country()
Get all the countries from database.
public
static country([bool|int $id = FALSE ][, bool $applyLimit = TRUE ]) : array<string|int, mixed>|null
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.
Parameters
- $id : bool|int = FALSE
-
- Optional id to return
- $applyLimit : bool = TRUE
Return values
array<string|int, mixed>|null —array reference of all countries.
countryIDForStateID()
Given a state ID return the country ID, this allows us to populate forms and values for downstream code
public
static countryIDForStateID(int $stateID) : int|null
Parameters
- $stateID : int
Return values
int|null —the country id that the state belongs to
countryIsoCode()
Get all the country ISO Code abbreviations from the database.
public
static countryIsoCode([bool $id = FALSE ]) : array<string|int, mixed>
Parameters
- $id : bool = FALSE
Return values
array<string|int, mixed>county()
Get all the County from database.
public
static & county([bool|int $id = FALSE ]) : array<string|int, mixed>
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.
Parameters
- $id : bool|int = FALSE
-
- Optional id to return
Return values
array<string|int, mixed> —array reference of all Counties
countyForState()
public
static & countyForState(int $stateID) : array<string|int, mixed>
Parameters
- $stateID : int
Return values
array<string|int, mixed>currencyCode()
Get all the ISO 4217 currency codes
public
static & currencyCode() : array<string|int, mixed>
Return values
array<string|int, mixed> —array reference of all currency codes
emailOnHoldOptions()
Get participant status class options.
public
static emailOnHoldOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>flush()
Flush given pseudoconstant so it can be reread from db next time it's requested.
public
static flush([bool|string $name = 'cache' ]) : mixed
Parameters
- $name : bool|string = 'cache'
-
pseudoconstant to be flushed
formatArrayOptions()
Convert multidimensional option list to flat array, if necessary
public
static formatArrayOptions(string|null $context, array<string|int, mixed> $options) : array<string|int, mixed>
Detect if an array of options is simple key/value pairs or a multidimensional array. If the latter, convert to a flat array, as determined by $context.
Parameters
- $context : string|null
-
See https://docs.civicrm.org/dev/en/latest/framework/pseudoconstant/#context
- $options : array<string|int, mixed>
-
List of options, each as a record of id+name+label. Ex: [['id' => 123, 'name' => 'foo_bar', 'label' => 'Foo Bar']]
Return values
array<string|int, mixed>get()
Legacy option getter.
public
static get(string $daoName, string $fieldName[, array<string|int, mixed> $params = [] ][, string $context = NULL ]) : array<string|int, mixed>|bool
in favor of Civi::entity()->getOptions()
Parameters
- $daoName : string
- $fieldName : string
- $params : array<string|int, mixed> = []
-
- name string name of the option group
- flip DEPRECATED
- grouping boolean if true, return the value in 'grouping' column (currently unsupported for tables other than option_value)
- localize boolean if true, localize the results before returning
- condition string|array add condition(s) to the sql query - will be concatenated using 'AND'
- keyColumn string the column to use for 'id'
- labelColumn string the column to use for 'label'
- orderColumn string the column to use for sorting, defaults to 'weight' column if one exists, else defaults to labelColumn
- onlyActive boolean return only the action option values
- fresh boolean ignore cache entries and go back to DB
- $context : string = NULL
-
: Context string
Tags
Return values
array<string|int, mixed>|bool —array on success, FALSE on error.
getExtensions()
Get all extensions.
public
static & getExtensions() : array<string|int, mixed>
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.
Return values
array<string|int, mixed> —array($fullyQualifiedName => $label) list of extensions
getKey()
Fetch the key for a field option given its name.
public
static getKey(string $baoName, string $fieldName, string|int $value) : bool|null|string|int
Parameters
- $baoName : string
- $fieldName : string
- $value : string|int
Return values
bool|null|string|int —FALSE if the given field has no associated option list NULL if the given key has no corresponding option String|Number if key is found
getLabel()
Fetch the translated label for a field given its key.
public
static getLabel(string $baoName, string $fieldName, string|int $key) : bool|null|string
Parameters
- $baoName : string
- $fieldName : string
- $key : string|int
-
TODO: Accept multivalued input?
Return values
bool|null|string —FALSE if the given field has no associated option list NULL if the given key has no corresponding option String if label is found
getModuleExtensions()
Fetch the list of active extensions of type 'module'
public
static getModuleExtensions([bool $fresh = FALSE ]) : array<string|int, mixed>
Parameters
- $fresh : bool = FALSE
-
Whether to forcibly reload extensions list from canonical store.
Return values
array<string|int, mixed> —array(array('prefix' => $, 'file' => $))
getName()
Fetch the machine name for a field given its key.
public
static getName(string $baoName, string $fieldName, string|int $key) : bool|null|string
Parameters
- $baoName : string
- $fieldName : string
- $key : string|int
Return values
bool|null|string —FALSE if the given field has no associated option list NULL if the given key has no corresponding option String if label is found
getOptionEditUrl()
Lookup the admin page at which a field's option list can be edited
public
static getOptionEditUrl(mixed $fieldSpec) : string|null
Parameters
- $fieldSpec : mixed
Return values
string|nullgetTaxRates()
Get all tax rates.
public
static getTaxRates() : array<string|int, mixed>
The static array tax rates is returned
Return values
array<string|int, mixed> —array list of tax rates with the financial type
greeting()
Get all types of Greetings.
public
static greeting(mixed $filter[, string $columnName = 'label' ]) : array<string|int, mixed>
The static array of greeting is returned
Parameters
- $filter : mixed
-
Get All Email Greetings - default is to get only active ones.
- $columnName : string = 'label'
Return values
array<string|int, mixed> —array reference of all greetings.
group()
Get all permissioned groups from database.
public
static group([string $groupType = NULL ][, bool $excludeHidden = TRUE ]) : array<string|int, mixed>
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.
Parameters
- $groupType : string = NULL
-
Type of group(Access/Mailing).
- $excludeHidden : bool = TRUE
-
Exclude hidden groups.
Return values
array<string|int, mixed> —array reference of all groups.
membershipStatus()
Get all the membership statuss.
public
static & membershipStatus([int $id = NULL ][, null $cond = NULL ][, string $column = 'name' ][, bool $force = FALSE ][, bool $allStatus = FALSE ]) : array<string|int, mixed>
Parameters
- $id : int = NULL
- $cond : null = NULL
- $column : string = 'name'
- $force : bool = FALSE
- $allStatus : bool = FALSE
Return values
array<string|int, mixed> —array reference of all membership statuses if any
membershipType()
Get all the membership types.
public
static membershipType([int $id = NULL ][, bool $force = TRUE ]) : array<string|int, mixed>
Parameters
- $id : int = NULL
- $force : bool = TRUE
Return values
array<string|int, mixed> —array reference of all membership types if any
nestedGroup()
Fetch groups in a nested format suitable for use in select form element.
public
static nestedGroup([bool $checkPermissions = TRUE ][, string|null $groupType = NULL ][, bool $excludeHidden = TRUE ]) : array<string|int, mixed>
Parameters
- $checkPermissions : bool = TRUE
- $groupType : string|null = NULL
- $excludeHidden : bool = TRUE
Return values
array<string|int, mixed>paymentProcessor()
public
static paymentProcessor([bool $all = FALSE ][, bool $test = FALSE ][, null $additionalCond = NULL ]) : array<string|int, mixed>
Please use the buildOptions() method in the appropriate BAO object. Get all active payment processors
The static array paymentProcessor is returned
Parameters
- $all : bool = FALSE
-
Get payment processors - default is to get only active ones.
- $test : bool = FALSE
-
Get test payment processors.
- $additionalCond : null = NULL
Return values
array<string|int, mixed> —array of all payment processors
paymentProcessorType()
public
static & paymentProcessorType([bool $all = FALSE ][, int $id = NULL ][, string $return = 'title' ]) : array<string|int, mixed>
Please use the buildOptions() method in the appropriate BAO object.
The static array paymentProcessorType is returned
Parameters
- $all : bool = FALSE
-
Get payment processors - default is to get only active ones.
- $id : int = NULL
- $return : string = 'title'
Return values
array<string|int, mixed> —array of all payment processor types
populate()
public
static populate(array<string|int, mixed> &$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 ]) : array<string|int, mixed>
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.
Parameters
- $var : array<string|int, mixed>
-
The associative array we will fill.
- $name : string
-
The name of the DAO.
- $all : bool = FALSE
-
Get all objects. default is to get only active ones.
- $retrieve : string = 'name'
-
The field that we are interested in (normally name, differs in some objects).
- $filter : string = 'is_active'
-
The field that we want to filter the result set with.
- $condition : string = NULL
-
The condition that gets passed to the final query as the WHERE clause.
- $orderby : bool = NULL
- $key : string = 'id'
- $force : bool = NULL
Return values
array<string|int, mixed>relationshipType()
Get all Relationship Types from database.
public
static relationshipType([string $valueColumnName = 'label' ][, bool $reset = FALSE ][, bool $isActive = 1 ]) : array<string|int, mixed>
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.
Parameters
- $valueColumnName : string = 'label'
-
Db column name/label.
- $reset : bool = FALSE
-
Reset relationship types if true.
- $isActive : bool = 1
-
Filter by is_active. NULL to disable.
Return values
array<string|int, mixed> —array reference of all relationship types.
relationshipTypeOptions()
Name => Label pairs for all relationship types
public
static relationshipTypeOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>renderOptionsFromTablePseudoconstant()
Render the field options from the available pseudoconstant.
public
static renderOptionsFromTablePseudoconstant(array<string|int, mixed> $pseudoconstant[, array<string|int, mixed> &$params = [] ][, string|null $localizeContext = NULL ][, string $context = '' ]) : array<string|int, mixed>|bool|mixed
Do not call this function directly or from untested code. Further cleanup is likely.
Parameters
- $pseudoconstant : array<string|int, mixed>
- $params : array<string|int, mixed> = []
- $localizeContext : string|null = NULL
- $context : string = ''
Return values
array<string|int, mixed>|bool|mixedstateProvince()
Get all the State/Province from database.
public
static & stateProvince([bool|int $id = FALSE ][, bool $limit = TRUE ]) : array<string|int, mixed>
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.
Parameters
- $id : bool|int = FALSE
-
- Optional id to return
- $limit : bool = TRUE
Return values
array<string|int, mixed> —array reference of all State/Provinces.
stateProvinceAbbreviation()
Get all the State/Province abbreviations from the database.
public
static stateProvinceAbbreviation([bool|int $id = FALSE ][, bool $limit = TRUE ]) : array<string|int, mixed>
Same as above, except gets the abbreviations instead of the names.
Parameters
- $id : bool|int = FALSE
-
- Optional id to return
- $limit : bool = TRUE
Return values
array<string|int, mixed> —array reference of all State/Province abbreviations.
stateProvinceAbbreviationForCountry()
Get all the State/Province abbreviations from the database for the specified country.
public
static stateProvinceAbbreviationForCountry(int $countryID) : array<string|int, mixed>
Parameters
- $countryID : int
Return values
array<string|int, mixed> —array of all State/Province abbreviations for the given country.
stateProvinceAbbreviationForDefaultCountry()
Get all the State/Province abbreviations from the database for the default country.
public
static stateProvinceAbbreviationForDefaultCountry() : array<string|int, mixed>
Return values
array<string|int, mixed> —array of all State/Province abbreviations for the given country.
stateProvinceForCountry()
public
static & stateProvinceForCountry(int $countryID[, string $field = 'name' ]) : array<string|int, mixed>
Parameters
- $countryID : int
- $field : string = 'name'
Return values
array<string|int, mixed>staticGroup()
Get all permissioned groups from database.
public
static & staticGroup([bool $onlyPublic = FALSE ][, null $groupType = NULL ][, bool $excludeHidden = TRUE ]) : array<string|int, mixed>
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.
Parameters
- $onlyPublic : bool = FALSE
- $groupType : null = NULL
- $excludeHidden : bool = TRUE
Return values
array<string|int, mixed> —array reference of all groups.
visibility()
public
static visibility([string $column = 'label' ]) : array<string|int, mixed>
Please use the buildOptions() method in the appropriate BAO object.
Get all Visibility levels.
The static array visibility is returned
Parameters
- $column : string = 'label'
Return values
array<string|int, mixed> —array reference of all Visibility levels.
worldRegion()
Get all the World Regions from Database.
public
static worldRegion([bool $id = FALSE ]) : array<string|int, mixed>
Parameters
- $id : bool = FALSE
Return values
array<string|int, mixed> —array reference of all World Regions