function juicebox_element_validate_dimension in Juicebox HTML5 Responsive Image Galleries 8.2
Same name and namespace in other branches
- 8.3 juicebox.module \juicebox_element_validate_dimension()
- 7.2 juicebox.module \juicebox_element_validate_dimension()
Form validation callback: validate width/height inputs.
1 string reference to 'juicebox_element_validate_dimension'
- JuiceboxFormatter::confBaseForm in src/
JuiceboxFormatter.php - Get common elements for Juicebox configuration forms.
File
- ./
juicebox.module, line 176 - Module file for Juicebox.
Code
function juicebox_element_validate_dimension($element, FormStateInterface $form_state, $form) {
if (!preg_match('/^[0-9]+?(%|px|em|in|cm|mm|ex|pt|pc)$/u', $element['#value'])) {
$form_state
->setError($element, t('Please ensure that your width and height values are entered in a standard numeric format (such as <strong>100%</strong> or <strong>300px</strong>).'));
}
}