You are here

function rrssb_form_validate in Ridiculously Responsive Social Sharing Buttons 7

Same name and namespace in other branches
  1. 7.2 rrssb.module \rrssb_form_validate()

Verify handler for rrssb_form().

1 string reference to 'rrssb_form_validate'
rrssb_form in ./rrssb.module
Implements hook_form().

File

./rrssb.module, line 297

Code

function rrssb_form_validate($form, &$form_state) {
  $follow = $form_state['values']['rrssb_follow'];
  $follow_text = $follow ? t('Follow') : t('Share');
  foreach ($form_state['values']['rrssb_chosen'] as $name => $settings) {
    if ($settings['enabled']) {
      if ($follow && isset($settings['username']) && !$settings['username']) {

        //@@TODO The form highlighting the error in red isn't working.
        form_set_error("rrssb_chosen[{$name}][username]", t('You must set the username to use "Follow" button for !button', array(
          '!button' => $name,
        )));
      }

      // If a button is enabled where there is no URL, we don't count that as an error, just don't show the button (@see rrssb_settings).
    }
  }
}