Skip to content
Snippets Groups Projects
Commit b2c50a6c authored by Nick Vanpraet's avatar Nick Vanpraet Committed by Michael Stenta
Browse files

Issue #3092530 by Grayle: Allow empty 'replace' patterns for MachineName render element

parent fa5921b6
No related branches found
No related tags found
1 merge request!9263Issue #3092530 by Grayle: Allow empty 'replace' patterns for MachineName render element
......@@ -245,7 +245,7 @@ public static function processMachineName(&$element, FormStateInterface $form_st
*/
public static function validateMachineName(&$element, FormStateInterface $form_state, &$complete_form) {
// Verify that the machine name not only consists of replacement tokens.
if (preg_match('@^' . $element['#machine_name']['replace'] . '+$@', $element['#value'])) {
if (!empty($element['#machine_name']['replace']) && preg_match('@^' . $element['#machine_name']['replace'] . '+$@', $element['#value'])) {
$form_state->setError($element, t('The machine-readable name must contain unique characters.'));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment