You are here

function _birthdays_required_if_user_checked in Birthdays 7

Render API callback: Validates that a field value is given, if the opt-out trigger checkbox is checked.

This function is assigned as an #element_validate callback in birthdays_field_instance_settings_form().

1 string reference to '_birthdays_required_if_user_checked'
birthdays_field_instance_settings_form in ./birthdays.module
Implements hook_field_instance_settings_form().

File

./birthdays.module, line 841
The Birthdays module allows users to add their birthday to their profile. It lists birthdays on a seperate page and in different blocks. Users can receive an email on their birthday automatically, and the administrator can receive daily reminders of…

Code

function _birthdays_required_if_user_checked($element, &$form_state, $form) {
  if (trim($element['#value']) === '') {
    if ($form_state['values']['instance']['settings']['triggers']['user']) {
      form_error($element, t('@title field is required.', array(
        '@title' => $element['#title'],
      )));
    }
  }
}