Hi,

I am trying to install the mailhandler module through an installation profile. But when I tried to do so, I got the following error:

Fatal error: Call to undefined function t() in /var/www/drupal/modules/mailhandler/mailhandler.install on line 77

Line 77 of mailhandler.install contains:


/**
 * Check that the IMAP extension exists for PHP.
 */
function mailhandler_requirements($phase) {
  $has_imap = function_exists('imap_open');
  $requirements['mailhandler'] = array(
    'title' => t('IMAP'),-----------------------------> LINE 77
    'description' => t("Mailhandler requires that PHP's !ext is enabled in order to function properly.", array('!ext' => l('IMAP extension', 'http://php.net/imap'))),-------------------------------->LINE 78
    'value' => $has_imap ? t('Enabled') : t('Not found'),
    'severity' => $has_imap ? REQUIREMENT_OK : REQUIREMENT_ERROR,
  );
  return $requirements;
}

When I changed t() to st(), I did not get this error. However now I am getting the following error:

Fatal error: Call to undefined function l() in /var/www/drupal/modules/mailhandler/mailhandler.install on line 78

Can anybody help me out with this?

Comments

oadaeh’s picture

You're probably trying to access the module before Drupal has completely bootstrapped. As I've not done anything with install profiles, I can't help you any further than that, other than to say try reading through the documentation: http://drupal.org/node/159730

Also, changing the t() function to the st() function is a bad idea, and not going to help you as they do fundamentally different things.

t():
http://api.drupal.org/api/function/t/5

st():
http://api.drupal.org/api/function/st/5

divyadd’s picture

I have already gone through the installation profile tutorials, and have been able to write a profile too. I have not made any configuration changes, but have only added the module in the list of modules to be installed through the profile. And this error is throwing up.

alesr’s picture

I have the same fatal error.
Only mailhandler throws t() not defined error??!

Anyone have a solution for this?

moshe weitzman’s picture

Status: Active » Fixed

committed a fix using get_t()

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.