'parents' => NULL,
];
+ // Fill title and frontend_title if not supplied
+ if (empty($params['id']) && empty($params['title'])) {
+ $params['title'] = $params['frontend_title'] ?? $params['name'];
+ }
if (empty($params['id']) && empty($params['frontend_title'])) {
- // If we were calling writeRecord it would handle this, but we need
- // to migrate the other bits of magic.
$params['frontend_title'] = $params['title'];
}
$hook = empty($params['id']) ? 'create' : 'edit';
// form the name only if missing: CRM-627
$nameParam = $params['name'] ?? NULL;
+ // If we were calling writeRecord it would handle this, but we need
+ // to migrate the other bits of magic.
if (!$nameParam && empty($params['id'])) {
$params['name'] = CRM_Utils_String::titleToVar($params['title']);
}
foreach ($requiredFields as $fieldName => $field) {
if (
!isset($values[$fieldName]) &&
- ($field['required'] || AbstractAction::evaluateCondition($field['required_if'], $values + $extraValues))
+ ($field['required'] || AbstractAction::evaluateCondition($field['required_if'], ['values' => $values + $extraValues]))
) {
- $extraValues[$fieldName] = $this->getRequiredValue($field, $requiredFields);
+ $extraValues[$fieldName] = $this->getRequiredValue($field);
}
}
* @inheritDoc
*/
public function modifySpec(RequestSpec $spec) {
- $spec->getFieldByName('name')->setRequired(FALSE)->setRequiredIf('empty($values.label)');
- $spec->getFieldByName('label')->setRequired(FALSE)->setRequiredIf('empty($values.name)');
+ $spec->getFieldByName('name')->setRequired(FALSE);
}
/**
],
'display' => [
'type' => 'table',
- 'label' => '',
+ 'label' => 'tesdDisplay',
'settings' => [
'limit' => 20,
'pager' => TRUE,
],
'display' => [
'type' => 'table',
- 'label' => '',
+ 'label' => 'tesdDisplay',
'settings' => [
'limit' => 20,
'pager' => TRUE,
],
'display' => [
'type' => 'table',
- 'label' => '',
+ 'label' => 'tesdDisplay',
'settings' => [
'actions' => TRUE,
'pager' => [],
],
'display' => [
'type' => 'table',
- 'label' => '',
+ 'label' => 'tesdDisplay',
'settings' => [
'actions' => TRUE,
'pager' => [],
],
'display' => [
'type' => 'table',
- 'label' => '',
+ 'label' => 'tesdDisplay',
'settings' => [
'limit' => 20,
'pager' => TRUE,
],
'display' => [
'type' => 'table',
- 'label' => '',
+ 'label' => 'tesdDisplay',
'settings' => [
'limit' => 20,
'pager' => FALSE,
'saved_search_id' => '$id',
'name' => $displayName,
'type' => 'table',
- 'label' => '',
+ 'label' => 'TestDisplay',
'acl_bypass' => TRUE,
'settings' => [
'limit' => 20,
],
'display' => [
'type' => 'list',
- 'label' => '',
+ 'label' => 'tesdDisplay',
'settings' => [
'limit' => 20,
'pager' => TRUE,
],
'display' => [
'type' => 'table',
- 'label' => '',
+ 'label' => 'tesdDisplay',
'settings' => [
'actions' => TRUE,
'pager' => [],
],
'display' => [
'type' => 'table',
- 'label' => '',
+ 'label' => 'tesdDisplay',
'settings' => [
'actions' => TRUE,
'pager' => [],
],
'display' => [
'type' => 'table',
- 'label' => '',
+ 'label' => 'tesdDisplay',
'settings' => [
'limit' => 20,
'pager' => TRUE,
],
'display' => [
'type' => 'table',
- 'label' => '',
+ 'label' => 'tesdDisplay',
'settings' => [
'actions' => TRUE,
'pager' => [],
],
'display' => [
'type' => 'table',
- 'label' => '',
+ 'label' => 'tesdDisplay',
'settings' => [
'actions' => TRUE,
'pager' => [],
],
'display' => [
'type' => 'table',
- 'label' => '',
+ 'label' => 'tesdDisplay',
'settings' => [
'limit' => 20,
'pager' => TRUE,
parent::tearDown();
}
- /**
- * Test missing required title parameter results in an error.
- *
- * @param int $version
- *
- * @dataProvider versionThreeAndFour
- */
- public function testGroupCreateNoTitle($version) {
- $this->_apiversion = $version;
- $params = [
- 'name' => 'Test Group No title ',
- 'domain_id' => 1,
- 'description' => 'New Test Group Created',
- 'is_active' => 1,
- 'visibility' => 'Public Pages',
- 'group_type' => [
- '1' => 1,
- '2' => 1,
- ],
- ];
-
- $this->callAPIFailure('group', 'create', $params, 'title');
- }
-
/**
* @param int $version
*