diff --git a/uw_cfg_common.module b/uw_cfg_common.module index d2329d3c3f09defc4a64c9c3fa9c68c84e468fe2..d9847a0e72d53eb2bd6ef04435e508d4c7cbcf62 100644 --- a/uw_cfg_common.module +++ b/uw_cfg_common.module @@ -1857,8 +1857,17 @@ function _uw_cfg_common_uw_link_validator($element, &$form_state, $form) { $form_state->setErrorByName($fieldname, t('The <button> value is not supported for this field.')); } - // Nolink is not allowed, with one exception. - if ($uri == '<nolink>' && $fieldname != 'field_uw_event_host][0][uri') { - $form_state->setErrorByName($fieldname, t('The <nolink> value is not supported for this field.')); + if ($uri == '<nolink>') { + // Don't allow blank link text when <nolink> is used. + 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 <nolink> as the URL.')); + } + } + else { + // Nolink is not allowed, with one exception (event host field). + $form_state->setErrorByName($fieldname, t('The <nolink> value is not supported for this field.')); + } } }