Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MUR Drupal
d3_sankey
Commits
2157c0c2
Commit
2157c0c2
authored
Nov 24, 2016
by
M Parker
Browse files
The d3 sankey libraries accept 0 as a possible number of iterations.
parent
8f0ee093
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
modules/d3_sankey_table_group_pp/d3_sankey_table_group_pp.module
.../d3_sankey_table_group_pp/d3_sankey_table_group_pp.module
+13
-1
No files found.
modules/d3_sankey_table_group_pp/d3_sankey_table_group_pp.module
View file @
2157c0c2
...
...
@@ -109,7 +109,7 @@ function d3_sankey_table_group_pp_field_formatter_settings_form($field, $instanc
$element
[
'iterations'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Iterations'
),
'#element_validate'
=>
array
(
'element_validate_integer_positive'
),
'#element_validate'
=>
array
(
'
_d3_sankey_table_group_pp_
element_validate_integer_positive
_or_zero
'
),
'#default_value'
=>
$settings
[
'iterations'
],
);
...
...
@@ -343,3 +343,15 @@ function _d3_sankey_table_group_pp_default_chart_options() {
'type'
=>
'sankey'
,
);
}
/* Form callbacks. */
/**
* Form element validation handler for integers that must be positive or zero.
*/
function
_d3_sankey_table_group_pp_element_validate_integer_positive_or_zero
(
$element
,
&
$form_state
)
{
$value
=
$element
[
'#value'
];
if
(
$value
!==
''
&&
(
!
is_numeric
(
$value
)
||
intval
(
$value
)
!=
$value
||
$value
<
0
))
{
form_error
(
$element
,
t
(
'%name must be a positive integer or zero.'
,
array
(
'%name'
=>
$element
[
'#title'
])));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment