I am trying to create a custom group and custom field using extension.
I created seperate funtion
function custom_group_create_example() {
$params = array(
'title' => 'Test_Group_1',
'name' => 'test_group_1',
'extends' => array(
'0' => 'Individual',
),
'weight' => 4,
'collapse_display' => 1,
'style' => 'Inline',
'help_pre' => 'This is Pre Help For Test Group 1',
'help_post' => 'This is Post Help For Test Group 1',
'is_active' => 1,
);
try{
$result = civicrm_api3('CustomGroup', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
return array(
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
);
}
return $result;
}
I call this funtion into
function contact_civicrm_install()
this funtion(hook).
But problem is that it is not creating any custom group.
How to resolve this problem.