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
24177ad0
Unverified
Commit
24177ad0
authored
1 month ago
by
Seamus Lee
Browse files
Options
Downloads
Patches
Plain Diff
#5716
Fix Regression with CheckBox custom fields not respecting the...
#5716
Fix Regression with CheckBox custom fields not respecting the options per line setting
parent
35559d1a
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/BAO/CustomField.php
+11
-3
11 additions, 3 deletions
CRM/Core/BAO/CustomField.php
CRM/Core/Form.php
+1
-0
1 addition, 0 deletions
CRM/Core/Form.php
CRM/Core/QuickForm/AdvCheckBoxWithDiv.php
+38
-0
38 additions, 0 deletions
CRM/Core/QuickForm/AdvCheckBoxWithDiv.php
with
50 additions
and
3 deletions
CRM/Core/BAO/CustomField.php
+
11
−
3
View file @
24177ad0
...
...
@@ -813,10 +813,18 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField implements \Civi
// TODO: I'm not sure if this is supposed to exclude whatever might be
// in $field->attributes (available in array format as
// $fieldAttributes). Leaving as-is for now.
$check
[]
=
&
$qf
->
addElement
(
'advcheckbox'
,
$v
,
NULL
,
$l
,
$customFieldAttributes
);
if
(
$field
->
options_per_line
)
{
$customFieldAttributes
[
'options_per_line'
]
=
$field
->
options_per_line
;
}
$check
[]
=
&
$qf
->
addElement
(
'advcheckbox_with_div'
,
$v
,
NULL
,
$l
,
$customFieldAttributes
);
}
if
(
$field
->
options_per_line
)
{
$group
=
$element
=
$qf
->
addElement
(
'group_with_div'
,
$elementName
,
$label
,
$check
,
''
,
TRUE
);
$group
->
setAttribute
(
'options_per_line'
,
$field
->
options_per_line
);
}
else
{
$group
=
$element
=
$qf
->
addGroup
(
$check
,
$elementName
,
$label
);
}
$group
=
$element
=
$qf
->
addGroup
(
$check
,
$elementName
,
$label
);
$optionEditKey
=
'data-option-edit-path'
;
if
(
isset
(
$customFieldAttributes
[
$optionEditKey
]))
{
$group
->
setAttribute
(
$optionEditKey
,
$customFieldAttributes
[
$optionEditKey
]);
...
...
This diff is collapsed.
Click to expand it.
CRM/Core/Form.php
+
1
−
0
View file @
24177ad0
...
...
@@ -392,6 +392,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
$this
->
_action
=
(
int
)
$action
;
$this
->
registerElementType
(
'radio_with_div'
,
'CRM/Core/QuickForm/RadioWithDiv.php'
,
'CRM_Core_QuickForm_RadioWithDiv'
);
$this
->
registerElementType
(
'group_with_div'
,
'CRM/Core/QuickForm/GroupWithDiv.php'
,
'CRM_Core_QuickForm_GroupWithDiv'
);
$this
->
registerElementType
(
'advcheckbox_with_div'
,
'CRM/Core/QuickForm/AdvCheckBoxWithDiv.php'
,
'CRM_Core_QuickForm_AdvCheckBoxWithDiv'
);
$this
->
registerRules
();
// let the constructor initialize this, should happen only once
...
...
This diff is collapsed.
Click to expand it.
CRM/Core/QuickForm/AdvCheckBoxWithDiv.php
0 → 100644
+
38
−
0
View file @
24177ad0
<?php
/*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
* @package CRM
*/
require_once
'HTML/QuickForm/advcheckbox.php'
;
/**
* Class CRM_Core_QuickForm_AdvCheckBoxWithDiv
*/
class
CRM_Core_QuickForm_AdvCheckBoxWithDiv
extends
HTML_QuickForm_advcheckbox
{
/**
* Returns the advcheckbox element in HTML
*
* @since 1.0
* @access public
* @return string
*/
public
function
toHtml
():
string
{
$html
=
parent
::
toHtml
();
if
(
is_numeric
(
$this
->
getAttribute
(
'options_per_line'
)))
{
return
'<div class="crm-option-label-pair" >'
.
$html
.
'</div>'
;
}
return
$html
;
}
}
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