function twitter_profile_widget_admin_validate in Twitter Profile Widget 7
Same name and namespace in other branches
- 6 twitter_profile_widget.admin.inc \twitter_profile_widget_admin_validate()
Validates twitter_profile_widget_admin form
1 string reference to 'twitter_profile_widget_admin_validate'
- twitter_profile_widget_admin in ./
twitter_profile_widget.admin.inc - Page callback Return form with twitter profile settings
File
- ./
twitter_profile_widget.admin.inc, line 306 - Administative form for the twitter profile widget module.
Code
function twitter_profile_widget_admin_validate($form, &$form_state) {
$values = $form_state['values'];
if (drupal_strlen($values['twitter_profile_widget_username']) < 2) {
form_set_error('twitter_profile_widget_username', t('Please, enter correct username'));
}
if (!ctype_digit($values['twitter_profile_widget_post_amount']) || $values['twitter_profile_widget_post_amount'] < 1 || $values['twitter_profile_widget_post_amount'] > 30) {
form_set_error('twitter_profile_widget_post_amount', t('Please, enter only digits from 1 to 30 in Post amount field'));
}
if (!ctype_digit($values['twitter_profile_widget_tweet_intervals']) || $values['twitter_profile_widget_tweet_intervals'] < 1 || $values['twitter_profile_widget_tweet_intervals'] > 20) {
form_set_error('twitter_profile_widget_tweet_intervals', t('Please, enter only digits from 1 to 20 in Twitter interval field'));
}
if (drupal_strlen($values['twitter_profile_widget_shell_bg_color']) != 6) {
form_set_error('twitter_profile_widget_shell_bg_color', t('Shell background color field must contain 6 characters'));
}
if (drupal_strlen($values['twitter_profile_widget_shell_text_color']) != 6) {
form_set_error('twitter_profile_widget_shell_text_color', t('Shell text color field must contain 6 characters'));
}
if (drupal_strlen($values['twitter_profile_widget_tweet_bg_color']) != 6) {
form_set_error('twitter_profile_widget_tweet_bg_color', t('Tweet background color field must contain 6 characters'));
}
if (drupal_strlen($values['twitter_profile_widget_tweet_text_color']) != 6) {
form_set_error('twitter_profile_widget_tweet_text_color', t('Tweet text color field must contain 6 characters'));
}
if (drupal_strlen($values['twitter_profile_widget_tweet_links_color']) != 6) {
form_set_error('twitter_profile_widget_tweet_links_color', t('Tweet links color field must contain 6 characters'));
}
if (drupal_substr(trim($values['twitter_profile_widget_follow_us_link']), 0, 7) != 'http://') {
form_set_error('twitter_profile_widget_follow_us_link', t('Follow us link should start with "http://"'));
}
if (!ctype_digit($values['twitter_profile_widget_width']) || $values['twitter_profile_widget_width'] < 1) {
form_set_error('twitter_profile_widget_width', t('Please, enter only digits in Twitter widget width field'));
}
if (!ctype_digit($values['twitter_profile_widget_height']) || $values['twitter_profile_widget_height'] < 1) {
form_set_error('twitter_profile_widget_height', t('Please, enter only digits in Twitter widget height field'));
}
}