+ /**
+ * Get options for a given field.
+ * @see CRM_Core_DAO::buildOptions
+ *
+ * @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();
+
+ $options = CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
+
+ // Output tag list as nested hierarchy
+ // TODO: This will only work when api.entity is "entity_tag". What about others?
+ if (($fieldName == 'tag' || $fieldName == 'tag_id') && ($context == 'search' || $context == 'create')) {
+ $options = CRM_Core_BAO_Tag::getTags('civicrm_contact', CRM_Core_DAO::$_nullArray, CRM_Utils_Array::value('parent_id', $params), '- ');
+ }
+
+ return $options;
+ }
+}