当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Contact_BAO_GroupContact::buildOptions方法代码示例

本文整理汇总了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);
 }
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:45,代码来源:Contact.php


注:本文中的CRM_Contact_BAO_GroupContact::buildOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。