You are here

function ed_classified_validate in Classified Ads 5

Same name and namespace in other branches
  1. 5.2 ed_classified.module \ed_classified_validate()
  2. 6.2 ed_classified.module \ed_classified_validate()
  3. 7.2 ed_classified.module \ed_classified_validate()

Implementation of hook_validate().

File

./ed_classified.module, line 761
Simple text-based classified ads module. Michael Curry, Exodus Development, Inc. exodusdev@gmail.com for more information, please visit http://exodusdev.com/drupal/modules/classified.module Copyright (c) 2006, 2007 Exodus Development, Inc. All Rights…

Code

function ed_classified_validate(&$form, $form_state) {
  module_load_include('inc', 'ed_classified', 'ed_classified_utils');

  // TODO: Enter form validation code here
  // - Min/max expiration dates
  // - settings: min/max expiration dates
  //
  // TODO: allow override on some ads, if paid for longer ads
  $maxlen = _ed_classified_variable_get('ad_standard_body_length', EDI_CLASSIFIED_VAR_DEF_BODYLEN_LIMIT);
  if (strlen(trim($form->body)) > $maxlen) {
    form_set_error('body', t('Ad text length is limited to !length characters.  Please shorten your entry to !length characters or less.', array(
      '!length' => $maxlen,
    )));
  }
}