'Custom Group', 'extends' => [$this->entity], 'weight' => 5, 'style' => 'Inline', 'max_multiple' => 0, ], $params); $this->ids['CustomGroup'][$params['title']] = $this->callAPISuccess('CustomGroup', 'create', $params)['id']; return $this->ids['CustomGroup'][$params['title']]; } /** * @return array */ public function createCustomFieldsOfAllTypes() { $customGroupID = $this->ids['CustomGroup']['Custom Group']; $ids = []; $params = [ 'custom_group_id' => $customGroupID, 'label' => 'Enter text here', 'html_type' => 'Text', 'data_type' => 'String', 'default_value' => 'xyz', 'weight' => 1, 'is_required' => 1, ]; $customField = $this->callAPISuccess('CustomField', 'create', $params); $ids[] = $customField['id']; $optionValue[] = [ 'label' => 'Red', 'value' => 'R', 'weight' => 1, 'is_active' => 1, ]; $optionValue[] = [ 'label' => 'Yellow', 'value' => 'Y', 'weight' => 2, 'is_active' => 1, ]; $optionValue[] = [ 'label' => 'Green', 'value' => 'G', 'weight' => 3, 'is_active' => 1, ]; $params = [ 'label' => 'Pick Color', 'html_type' => 'Select', 'data_type' => 'String', 'weight' => 2, 'is_required' => 1, 'is_searchable' => 0, 'is_active' => 1, 'option_values' => $optionValue, 'custom_group_id' => $customGroupID, ]; $customField = $this->callAPISuccess('custom_field', 'create', $params); $ids[] = $customField['id']; $params = [ 'custom_group_id' => $customGroupID, 'name' => 'test_date', 'label' => 'test_date', 'html_type' => 'Select Date', 'data_type' => 'Date', 'default_value' => '20090711', 'weight' => 3, 'is_required' => 1, 'is_searchable' => 0, 'is_active' => 1, ]; $customField = $this->callAPISuccess('custom_field', 'create', $params); $ids[] = $customField['id']; $params = [ 'custom_group_id' => $customGroupID, 'name' => 'test_link', 'label' => 'test_link', 'html_type' => 'Link', 'data_type' => 'Link', 'default_value' => 'http://civicrm.org', 'weight' => 4, 'is_required' => 1, 'is_searchable' => 0, 'is_active' => 1, ]; $customField = $this->callAPISuccess('custom_field', 'create', $params); $ids[] = $customField['id']; return $ids; } }