Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
usersurveys
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
thundercats
usersurveys
Merge requests
!14
Unit labels
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Unit labels
unit-labels
into
master
Overview
0
Commits
1
Changes
3
Merged
jesschampion
requested to merge
unit-labels
into
master
8 years ago
Overview
0
Commits
1
Changes
3
Expand
0
0
Merge request reports
Compare
master
version 1
28b73093
8 years ago
master (base)
and
latest version
latest version
28b73093
1 commit,
8 years ago
version 1
28b73093
3 commits,
8 years ago
3 files
+
68
−
9
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
code/extensions/EditableNumericFieldExtension.php
+
16
−
0
Options
@@ -3,6 +3,18 @@
class
EditableNumericFieldExtension
extends
DataExtension
{
private
static
$db
=
array
(
'UnitLabel'
=>
'Varchar(255)'
,
);
public
function
updateCMSFields
(
FieldList
$fields
)
{
// Responsive title field for dynamically piping data
$fields
->
insertBefore
(
'HelpText'
,
TextField
::
create
(
'UnitLabel'
,
'Unit Label'
)
->
setDescription
(
'Set a unit for the field. (eg. Hectares, Meters, Kilograms)'
)
);
}
public
function
updateFieldDefinition
(
&
$def
)
{
@@ -15,6 +27,10 @@ class EditableNumericFieldExtension extends DataExtension
if
(
!
empty
(
$this
->
owner
->
MaxValue
))
{
$def
[
'max'
]
=
(
int
)
$this
->
owner
->
MaxValue
;
}
if
(
!
empty
(
$this
->
owner
->
UnitLabel
))
{
$def
[
'unitLabel'
]
=
$this
->
owner
->
UnitLabel
;
}
}
}
\ No newline at end of file