}
}
+ if (array_key_exists('is_reserved', $params)) {
+ $group->is_reserved = $params['is_reserved'] ? 1 : 0;
+ }
+ $op = isset($params['id']) ? 'edit' : 'create';
+ CRM_Utils_Hook::pre($op, 'CustomGroup', CRM_Utils_Array::value('id', $params), $params);
+
// enclose the below in a transaction
$transaction = new CRM_Core_Transaction();
return $groupTree;
}
+ /**
+ * @param $entityType
+ * @param $path
+ * @param string $cidToken
+ *
+ * @return array
+ */
public static function &getActiveGroups($entityType, $path, $cidToken = '%%cid%%') {
// for Group's
$customGroupDAO = new CRM_Core_DAO_CustomGroup();
$group['query'] = "reset=1&gid={$customGroupDAO->id}&cid={$cidToken}";
$group['extra'] = array('gid' => $customGroupDAO->id);
$group['table_name'] = $customGroupDAO->table_name;
+ $group['is_multiple'] = $customGroupDAO->is_multiple;
$groups[] = $group;
}
*
* @return string $tableName
*
- * @access private
+ * @access public
* @static
*
+ * @see _apachesolr_civiAttachments_dereference_file_parent
*/
- private static function _getTableName($entityType) {
+ public static function getTableNameByEntityName($entityType) {
$tableName = '';
switch ($entityType) {
case 'Contact':
return TRUE;
}
+ /**
+ * @param $groupTree
+ * @param $defaults
+ * @param bool $viewMode
+ * @param bool $inactiveNeeded
+ * @param int $action
+ */
static function setDefaults(&$groupTree, &$defaults, $viewMode = FALSE, $inactiveNeeded = FALSE, $action = CRM_Core_Action::NONE) {
foreach ($groupTree as $id => $group) {
if (!isset($group['fields'])) {
continue;
}
- $groupId = CRM_Utils_Array::value('id', $group);
foreach ($group['fields'] as $field) {
if (CRM_Utils_Array::value('element_value', $field) !== NULL) {
$value = $field['element_value'];
continue;
}
- $fieldId = $field['id'];
- $elementName = $field['element_name'];
+ if (!empty($field['element_name'])) {
+ $elementName = $field['element_name'];
+ }
switch ($field['html_type']) {
case 'Multi-Select':
case 'AdvMulti-Select':
}
}
+ /**
+ * @param $groupTree
+ * @param $params
+ * @param bool $skipFile
+ */
static function postProcess(&$groupTree, &$params, $skipFile = FALSE) {
// Get the Custom form values and groupTree
// first reset all checkbox and radio data
return TRUE;
}
+ /**
+ * @param $table
+ *
+ * @return string
+ * @throws Exception
+ */
static function mapTableName($table) {
switch ($table) {
case 'Contact':
}
}
+ /**
+ * @param $group
+ */
static function createTable($group) {
$params = array(
'name' => $group->table_name,
return $objTypes;
}
+ /**
+ * @param $customGroupId
+ * @param $entityId
+ *
+ * @return bool
+ */
static function hasReachedMaxLimit($customGroupId, $entityId) {
//check whether the group is multiple
$isMultiple = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'is_multiple');
return $hasReachedMax;
}
+ /**
+ * @return array
+ */
static function getMultipleFieldGroup() {
$multipleGroup = array();
$dao = new CRM_Core_DAO_CustomGroup();