Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
9c75ef60
Commit
9c75ef60
authored
10 years ago
by
Jared Hancock
Browse files
Options
Downloads
Patches
Plain Diff
forms: Any field can have sub fields
Not just the SelectionField. This will make room for the InlineFormField
parent
3770653f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/class.dynamic_forms.php
+13
-6
13 additions, 6 deletions
include/class.dynamic_forms.php
include/class.forms.php
+12
-0
12 additions, 0 deletions
include/class.forms.php
with
25 additions
and
6 deletions
include/class.dynamic_forms.php
+
13
−
6
View file @
9c75ef60
...
@@ -249,8 +249,8 @@ Filter::addSupportedMatches(/* @trans */ 'User Data', function() {
...
@@ -249,8 +249,8 @@ Filter::addSupportedMatches(/* @trans */ 'User Data', function() {
if
(
!
$f
->
hasData
())
if
(
!
$f
->
hasData
())
continue
;
continue
;
$matches
[
'field.'
.
$f
->
get
(
'id'
)]
=
__
(
'User'
)
.
' / '
.
$f
->
getLabel
();
$matches
[
'field.'
.
$f
->
get
(
'id'
)]
=
__
(
'User'
)
.
' / '
.
$f
->
getLabel
();
if
((
$fi
=
$f
->
getImpl
())
instanceof
Selection
Field
)
{
if
((
$fi
=
$f
->
getImpl
())
&&
$fi
->
hasSub
Field
s
()
)
{
foreach
(
$fi
->
get
List
()
->
getForm
()
->
get
Fields
()
as
$p
)
{
foreach
(
$fi
->
get
Sub
Fields
()
as
$p
)
{
$matches
[
'field.'
.
$f
->
get
(
'id'
)
.
'.'
.
$p
->
get
(
'id'
)]
$matches
[
'field.'
.
$f
->
get
(
'id'
)
.
'.'
.
$p
->
get
(
'id'
)]
=
__
(
'User'
)
.
' / '
.
$f
->
getLabel
()
.
' / '
.
$p
->
getLabel
();
=
__
(
'User'
)
.
' / '
.
$f
->
getLabel
()
.
' / '
.
$p
->
getLabel
();
}
}
...
@@ -339,8 +339,8 @@ Filter::addSupportedMatches(/* @trans */ 'Ticket Data', function() {
...
@@ -339,8 +339,8 @@ Filter::addSupportedMatches(/* @trans */ 'Ticket Data', function() {
if
(
!
$f
->
hasData
())
if
(
!
$f
->
hasData
())
continue
;
continue
;
$matches
[
'field.'
.
$f
->
get
(
'id'
)]
=
__
(
'Ticket'
)
.
' / '
.
$f
->
getLabel
();
$matches
[
'field.'
.
$f
->
get
(
'id'
)]
=
__
(
'Ticket'
)
.
' / '
.
$f
->
getLabel
();
if
((
$fi
=
$f
->
getImpl
())
instanceof
Selection
Field
)
{
if
((
$fi
=
$f
->
getImpl
())
&&
$fi
->
hasSub
Field
s
()
)
{
foreach
(
$fi
->
get
List
()
->
getForm
()
->
get
Fields
()
as
$p
)
{
foreach
(
$fi
->
get
Sub
Fields
()
as
$p
)
{
$matches
[
'field.'
.
$f
->
get
(
'id'
)
.
'.'
.
$p
->
get
(
'id'
)]
$matches
[
'field.'
.
$f
->
get
(
'id'
)
.
'.'
.
$p
->
get
(
'id'
)]
=
__
(
'Ticket'
)
.
' / '
.
$f
->
getLabel
()
.
' / '
.
$p
->
getLabel
();
=
__
(
'Ticket'
)
.
' / '
.
$f
->
getLabel
()
.
' / '
.
$p
->
getLabel
();
}
}
...
@@ -381,8 +381,8 @@ Filter::addSupportedMatches(/* trans */ 'Custom Forms', function() {
...
@@ -381,8 +381,8 @@ Filter::addSupportedMatches(/* trans */ 'Custom Forms', function() {
if
(
!
$f
->
hasData
())
if
(
!
$f
->
hasData
())
continue
;
continue
;
$matches
[
'field.'
.
$f
->
get
(
'id'
)]
=
$form
->
getTitle
()
.
' / '
.
$f
->
getLabel
();
$matches
[
'field.'
.
$f
->
get
(
'id'
)]
=
$form
->
getTitle
()
.
' / '
.
$f
->
getLabel
();
if
((
$fi
=
$f
->
getImpl
())
instanceof
Selection
Field
)
{
if
((
$fi
=
$f
->
getImpl
())
&&
$fi
->
hasSub
Field
s
()
)
{
foreach
(
$fi
->
get
List
()
->
getPropertie
s
()
as
$p
)
{
foreach
(
$fi
->
get
SubField
s
()
as
$p
)
{
$matches
[
'field.'
.
$f
->
get
(
'id'
)
.
'.'
.
$p
->
get
(
'id'
)]
$matches
[
'field.'
.
$f
->
get
(
'id'
)
.
'.'
.
$p
->
get
(
'id'
)]
=
$form
->
getTitle
()
.
' / '
.
$f
->
getLabel
()
.
' / '
.
$p
->
getLabel
();
=
$form
->
getTitle
()
.
' / '
.
$f
->
getLabel
()
.
' / '
.
$p
->
getLabel
();
}
}
...
@@ -1030,6 +1030,13 @@ class SelectionField extends FormField {
...
@@ -1030,6 +1030,13 @@ class SelectionField extends FormField {
return
true
;
return
true
;
}
}
function
hasSubFields
()
{
return
true
;
}
function
getSubFields
()
{
return
$this
->
getConfigurationForm
()
->
getFields
();
}
function
toString
(
$items
)
{
function
toString
(
$items
)
{
return
(
$items
&&
is_array
(
$items
))
return
(
$items
&&
is_array
(
$items
))
?
implode
(
', '
,
$items
)
:
(
string
)
$items
;
?
implode
(
', '
,
$items
)
:
(
string
)
$items
;
...
...
This diff is collapsed.
Click to expand it.
include/class.forms.php
+
12
−
0
View file @
9c75ef60
...
@@ -538,6 +538,18 @@ class FormField {
...
@@ -538,6 +538,18 @@ class FormField {
return
false
;
return
false
;
}
}
/**
* Indicates if the field has subfields accessible via getSubFields()
* method. Useful for filter integration. Should connect with
* getFilterData()
*/
function
hasSubFields
()
{
return
false
;
}
function
getSubFields
()
{
return
null
;
}
function
getConfigurationForm
(
$source
=
null
)
{
function
getConfigurationForm
(
$source
=
null
)
{
if
(
!
$this
->
_cform
)
{
if
(
!
$this
->
_cform
)
{
$type
=
static
::
getFieldType
(
$this
->
get
(
'type'
));
$type
=
static
::
getFieldType
(
$this
->
get
(
'type'
));
...
...
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