You are here

function _ed_classified_check_settings in Classified Ads 7.2

Same name and namespace in other branches
  1. 5.2 ed_classified_utils.inc \_ed_classified_check_settings()
  2. 5 ed_classified_utils.inc \_ed_classified_check_settings()
  3. 6.2 ed_classified_utils.inc \_ed_classified_check_settings()

do the sanity-check dance.

1 call to _ed_classified_check_settings()
ed_classified_admin_settings in ./ed_classified_settings.inc
Implementation of hook_settings(). TODO - this is hardcoded to the Classified Ads vid - needs to be able to handle any taxonomy assigned

File

./ed_classified_utils.inc, line 276
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_check_settings(&$form) {
  $vid = _ed_classified_get_vid();
  $taxonomy = taxonomy_get_tree($vid);
  $warning = "";
  if (empty($taxonomy)) {
    if (!empty($vid)) {
      $url = "admin/content/taxonomy/{$vid}/add/term";
      $url = l('taxonomy administration', $url);
      $warning = t('<div class="error">It appears that you have not configured any vocabulary terms to be used with the Classified Ads module.  This module will not function correctly until you define vocabulary terms for vocabulary id !vid.  Please visit !url to add terms such as "For Sale" or "Wanted" (or other categories as appropriate for your needs).</div>', array(
        '!url' => $url,
        '!vid' => $vid,
      ));
    }
    else {
      $url = 'http://exodusdev.com/drupal/modules/ed_classified.module';
      $url = l('the project homepage', $url);
      $warning = t('<div class="error">The classified ads vocabulary settings are not configured correctly.  This is mostly likely due to a failed installation or an administrator deleting the automatically configured taxonomy or other problems.  Please visit the online handbook page(s) at !url.</div>', array(
        '!url' => $url,
      ));
    }
    $form['warning'] = array(
      '#type' => 'markup',
      '#value' => $warning,
    );
    return FALSE;
  }
  return TRUE;
}