本文整理汇总了PHP中CRM_Contact_BAO_GroupContact::buildOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_GroupContact::buildOptions方法的具体用法?PHP CRM_Contact_BAO_GroupContact::buildOptions怎么用?PHP CRM_Contact_BAO_GroupContact::buildOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_GroupContact
的用法示例。
在下文中一共展示了CRM_Contact_BAO_GroupContact::buildOptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildOptions
/**
* Get options for a given contact field.
*
* @see CRM_Core_DAO::buildOptions
*
* TODO: Should we always assume chainselect? What fn should be responsible for controlling that flow?
* TODO: In context of chainselect, what to return if e.g. a country has no states?
*
* @param string $fieldName
* @param string $context
* @see CRM_Core_DAO::buildOptionsContext
* @param array $props
* whatever is known about this dao object.
*
* @return array|bool
*/
public static function buildOptions($fieldName, $context = NULL, $props = array())
{
$params = array();
// Special logic for fields whose options depend on context or properties
switch ($fieldName) {
case 'contact_sub_type':
if (!empty($props['contact_type'])) {
$params['condition'] = "parent_id = (SELECT id FROM civicrm_contact_type WHERE name='{$props['contact_type']}')";
}
break;
case 'contact_type':
if ($context == 'search') {
// CRM-15495 - EntityRef filters and basic search forms expect this format
// FIXME: Search builder does not
return CRM_Contact_BAO_ContactType::getSelectElements();
}
break;
// The contact api supports some related entities so we'll honor that by fetching their options
// The contact api supports some related entities so we'll honor that by fetching their options
case 'group_id':
case 'group':
return CRM_Contact_BAO_GroupContact::buildOptions('group_id', $context, $props);
case 'tag_id':
case 'tag':
$props['entity_table'] = 'civicrm_contact';
return CRM_Core_BAO_EntityTag::buildOptions('tag_id', $context, $props);
}
return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
}