Skip to content
Snippets Groups Projects
Commit af08c37f authored by Lily Yan's avatar Lily Yan
Browse files

ISTWCMS-6260 Don't allow blank link text when <nolink> is used

parent 20836451
No related branches found
No related tags found
1 merge request!319ISTWCMS-6260 Don't allow blank link text when <nolink> is used
...@@ -1857,8 +1857,17 @@ function _uw_cfg_common_uw_link_validator($element, &$form_state, $form) { ...@@ -1857,8 +1857,17 @@ function _uw_cfg_common_uw_link_validator($element, &$form_state, $form) {
$form_state->setErrorByName($fieldname, t('The &lt;button&gt; value is not supported for this field.')); $form_state->setErrorByName($fieldname, t('The &lt;button&gt; value is not supported for this field.'));
} }
// Nolink is not allowed, with one exception. if ($uri == '<nolink>') {
if ($uri == '<nolink>' && $fieldname != 'field_uw_event_host][0][uri') { // Don't allow blank link text when <nolink> is used.
$form_state->setErrorByName($fieldname, t('The &lt;nolink&gt; value is not supported for this field.')); if ($fieldname == 'field_uw_event_host][0][uri') {
$link_text = $form_state->getValue('field_uw_event_host')[0]['title'] ?? '';
if ($link_text == '') {
$form_state->setErrorByName('field_uw_event_host][0][title', t('You must provide link text when using &lt;nolink&gt; as the URL.'));
}
}
else {
// Nolink is not allowed, with one exception (event host field).
$form_state->setErrorByName($fieldname, t('The &lt;nolink&gt; value is not supported for this field.'));
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment