Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
a674c37c
Unverified
Commit
a674c37c
authored
3 years ago
by
Eileen McNaughton
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #20481 from colemanw/getFieldsFix
APIv4 - Fix getFields to respect default_value from getFields
parents
bedd4475
88620a59
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CRM/Core/DAO/CustomGroup.php
+2
-1
2 additions, 1 deletion
CRM/Core/DAO/CustomGroup.php
Civi/Api4/Generic/BasicGetFieldsAction.php
+11
-9
11 additions, 9 deletions
Civi/Api4/Generic/BasicGetFieldsAction.php
xml/schema/Core/CustomGroup.xml
+1
-0
1 addition, 0 deletions
xml/schema/Core/CustomGroup.xml
with
14 additions
and
10 deletions
CRM/Core/DAO/CustomGroup.php
+
2
−
1
View file @
a674c37c
...
...
@@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Core/CustomGroup.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:
fc2cf4a8b27ca8d4eaced3f1a3fcddd5
)
* (GenCodeChecksum:
ddee40c6f144396056437d29bc0337d7
)
*/
/**
...
...
@@ -437,6 +437,7 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
'html'
=>
[
'label'
=>
ts
(
"Table Name"
),
],
'readonly'
=>
TRUE
,
'add'
=>
'2.0'
,
],
'is_multiple'
=>
[
...
...
This diff is collapsed.
Click to expand it.
Civi/Api4/Generic/BasicGetFieldsAction.php
+
11
−
9
View file @
a674c37c
...
...
@@ -111,7 +111,8 @@ class BasicGetFieldsAction extends BasicGetAction {
* @param array $values
*/
protected
function
formatResults
(
&
$values
)
{
$fields
=
array_column
(
$this
->
fields
(),
'name'
);
$fieldDefaults
=
array_column
(
$this
->
fields
(),
'default_value'
,
'name'
)
+
array_fill_keys
(
array_column
(
$this
->
fields
(),
'name'
),
NULL
);
// Enforce field permissions
if
(
$this
->
checkPermissions
)
{
foreach
(
$values
as
$key
=>
$field
)
{
...
...
@@ -124,17 +125,15 @@ class BasicGetFieldsAction extends BasicGetAction {
$defaults
=
array_intersect_key
([
'title'
=>
empty
(
$field
[
'name'
])
?
NULL
:
ucwords
(
str_replace
(
'_'
,
' '
,
$field
[
'name'
])),
'entity'
=>
$this
->
getEntityName
(),
'required'
=>
FALSE
,
'readonly'
=>
FALSE
,
'options'
=>
!
empty
(
$field
[
'pseudoconstant'
]),
'data_type'
=>
\CRM_Utils_Array
::
value
(
'type'
,
$field
,
'String'
),
],
array_flip
(
$fields
));
$field
+=
$defaults
;
$field
[
'label'
]
=
$field
[
'label'
]
??
$field
[
'title'
];
],
$fieldDefaults
);
$field
+=
$defaults
+
$fieldDefaults
;
if
(
array_key_exists
(
'label'
,
$fieldDefaults
))
{
$field
[
'label'
]
=
$field
[
'label'
]
??
$field
[
'title'
]
??
$field
[
'name'
];
}
if
(
isset
(
$defaults
[
'options'
]))
{
$field
[
'options'
]
=
$this
->
formatOptionList
(
$field
[
'options'
]);
}
$field
+=
array_fill_keys
(
$fields
,
NULL
);
}
}
...
...
@@ -261,6 +260,7 @@ class BasicGetFieldsAction extends BasicGetAction {
[
'name'
=>
'required'
,
'data_type'
=>
'Boolean'
,
'default_value'
=>
FALSE
,
],
[
'name'
=>
'required_if'
,
...
...
@@ -269,10 +269,11 @@ class BasicGetFieldsAction extends BasicGetAction {
[
'name'
=>
'options'
,
'data_type'
=>
'Array'
,
'default_value'
=>
FALSE
,
],
[
'name'
=>
'data_type'
,
'd
ata_typ
e'
=>
'String'
,
'd
efault_valu
e'
=>
'String'
,
'options'
=>
[
'Array'
=>
ts
(
'Array'
),
'Boolean'
=>
ts
(
'Boolean'
),
...
...
@@ -319,6 +320,7 @@ class BasicGetFieldsAction extends BasicGetAction {
'name'
=>
'readonly'
,
'data_type'
=>
'Boolean'
,
'description'
=>
'True for auto-increment, calculated, or otherwise non-editable fields.'
,
'default_value'
=>
FALSE
,
],
[
'name'
=>
'output_formatters'
,
...
...
This diff is collapsed.
Click to expand it.
xml/schema/Core/CustomGroup.xml
+
1
−
0
View file @
a674c37c
...
...
@@ -147,6 +147,7 @@
<html>
<label>
Table Name
</label>
</html>
<readonly>
true
</readonly>
<add>
2.0
</add>
</field>
<field>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment