You are here

function linkimagefield_init in Link Image Field 6

Implementation of hook_init().

Load required includes.

File

./linkimagefield.module, line 20
Defines a link image field type.

Code

function linkimagefield_init() {

  // If Content, FileField, or ImageField is not available, immediately disable Link Image Field.
  $disable = FALSE;
  $message = '';
  if (!module_exists('content')) {
    $disable = TRUE;
    $message = t('The <a href="http://drupal.org/project/cck">Content Creation Kit</a> needs to be installed for it to work properly.');
  }
  if (!module_exists('filefield')) {
    $disable = TRUE;
    $message = (!empty($message) ? '<br />' : '') . t('The <a href="http://drupal.org/project/filefield">FileField module</a> needs to be installed for it to work properly.');
  }
  if (!module_exists('imagefield')) {
    $disable = TRUE;
    $message = (!empty($message) ? '<br />' : '') . t('The <a href="http://drupal.org/project/imagefield">ImageField module</a> needs to be installed for it to work properly.');
  }
  if ($disable) {
    module_disable(array(
      'linkimagefield',
    ));
    drupal_set_message(t('The Link Image Field module has been disabled.<br />') . $message);
    return;
  }

  // Load include code
  module_load_include('inc', 'linkimagefield', 'linkimagefield_widget');
}