You are here

function phone_cck_convert_init in Phone 7.2

Implements hook_init().

Add message for admins letting them know status of module.

File

phone_cck_convert/phone_cck_convert.module, line 33
Converts cck_phone-7.x-1.x fields into phone-7.x-2.x fields. (Note that cck_phone-6.x fields are handled by cck's content_migrate module.)

Code

function phone_cck_convert_init() {

  // Only show message to admins.
  // Plus skip message if they're already at the form page.
  if (user_access('access administration pages') && request_path() != 'admin/config/content/phone-cck-convert') {
    $nfields = db_select('field_config')
      ->condition('module', 'cck_phone')
      ->countQuery()
      ->execute()
      ->fetchField();
    if (!$nfields) {
      drupal_set_message(t('There are no cck_phone fields that need to be converted into phone fields. You can disable the CCK Phone Converter module.'), 'status', FALSE);
    }
    else {
      drupal_set_message(t('The CCK Phone Converter module has not yet been run. To convert all cck_phone fields into phone fields, go the the <a href="!url">Converter admin page</a>.', array(
        '!url' => url('admin/config/content/phone-cck-convert'),
      )), 'status', FALSE);
    }
  }
}