You are here

function _classified_get_vars in Classified Ads 7.3

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

List the module variables.

This is a first step towards D8 hook_variable_info(). See http://drupal.org/node/145164.

No static cache: there is no reason for this function to be invoked multiple times on a page.

Return value

array A hash of the variables and their defaults

4 calls to _classified_get_vars()
classified_block_save in ./classified.module
Implements hook_block_save().
classified_install in ./classified.install
Implements hook_install().
classified_uninstall in ./classified.install
Implements hook_uninstall().
_classified_get in ./classified.module
A simplified alternative to variable_get().

File

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

Code

function _classified_get_vars() {
  $vars = array(
    'vid' => 0,
    'max-length' => 500,
    'list-body' => 'empty',
    'date-format' => t('%d/%m/%Y'),
    // 2 weeks lifetime.
    'lifetimes' => array(
      0 => 2 * 7,
    ),
    // 1 week grace after expiration.
    'grace' => 7,
    'recent-count' => 5,
    'popular-count' => 5,
    // Editing a node sends it back to moderation (modr8) if available.
    'edit-modr8' => TRUE,
    // New in D7: field names.
    'field-category' => 'classified_category',
    // Optional classified_notifications module.
    'notifications-half-life-subject' => t('Classified Ad on [site:name]: half-life warning.'),
    'notifications-half-life-body' => t("Some of your Classified Ads on [site:name] have reached half their lifetime. They are listed below for your convenience.\n\nPlease visit your ads list at [user:classified-ads-url] if you wish to modify them.\n\n[user:classified-ads-plain]\n"),
    'notifications-pre-expire-subject' => t('Classified Ad on [site:name]: pre-expiration warning.'),
    'notifications-pre-expire-body' => t("Some of your Classified Ads on [site:name] will expire tomorrow. They are listed below for your convenience.\n\nPlease visit your ads list at [user:classified-ads-url] if you wish to extend their lifetime.\n\n[user:classified-ads-plain]\n"),
    'notifications-expire-subject' => t('Classified Ad expiration on [site:name] warning.'),
    'notifications-expire-body' => t("Some of your Classified Ads on [site:name] have expired. They are listed below for your convenience.\n\nPlease visit your ads list at [user:classified-ads-url] if you wish to renew them.\n\n[user:classified-ads-plain]\n"),
    'notifications-pre-purge-subject' => t('Classified Ad on [site:name]: pre-purge warning.'),
    'notifications-pre-purge-body' => t("Some of your expired Classified Ads on [site:name] will be deleted tomorrow. They are listed below for your convenience.\n\nPlease visit your ads list at [user:classified-ads-url] if you wish to avoid their deletion.\n\n[user:classified-ads-plain]\n"),
    'notifications-purge-subject' => t('Classified Ad purge on [site:name] warning.'),
    'notifications-purge-body' => t("Some of your expired Classified Ads on [site:name] have been purged. They are listed below for your convenience.\n\nPlease visit your ads list at [user:classified-ads-url] to check your remaining ads.\n\n[user:classified-ads-plain]\n"),
  );
  $ret = array();
  foreach ($vars as $name => $default) {
    $ret['classified-' . $name] = $default;
  }
  return $ret;
}