You are here

function classified_block_save in Classified Ads 7.3

Same name and namespace in other branches
  1. 6.3 classified.module \classified_block_save()

Implements hook_block_save().

File

./classified.module, line 783
A pure D7 classified ads module inspired by the ed_classified module.

Code

function classified_block_save($delta, $edit) {
  if (in_array($delta, array(
    'recent',
    'popular',
  ))) {
    $vars = _classified_get_vars();
    $name = 'classified-' . $delta . '-count';
    $count = $edit[$name];
    if (!is_numeric($count) || $count < 0 || $count > 999) {
      drupal_set_message(t('Invalid number of entries requested (@count). Resetting to default (@default).', array(
        '@count' => empty($count) ? 0 : $count,
        '@default' => $vars[$name],
      )));
      $count = $vars[$name];
    }
    variable_set($name, $count);
  }
}