Search code examples
drupaldrupal-7updates

How to load a function during drupal update hook


I created a update hook for my module, in which I would like to create some aliases with pathauto_create_alias.

I get the error Call to undefined function pathauto_create_alias() in.What is the best way to include this module so that the function does exist ?


Solution

  • The pathauto_create_alias() function is part of the pathauto.inc which is not automatically loaded.

    To include this file in your HOOK_update(), can use:

    module_load_include('inc', 'pathauto');