You are here

function _linkicon_element_validate_link_title in Link Icon 7

Validate predefined link title.

Since Link title is not required, we make sure that it is not empty if the URL field is not. In the opposite, link.module does validation.

@todo: error field receives no error class.

1 string reference to '_linkicon_element_validate_link_title'
linkicon_field_process in ./linkicon.module
Overrides link_field_process() to use a select box.

File

./linkicon.module, line 244
A link field formatter to create icon classes based on predefined titles.

Code

function _linkicon_element_validate_link_title($element, &$form_state, $form) {
  if (empty($element['#value']['title']) && !empty($element['#value']['url'])) {
    form_set_error($element['#value']['title'], t('Title must be filled in if URL is provided.'));
  }
}