Drupal Answers Asked by Idjit on December 19, 2021
I use taxonomy_get_term_by_name()
in one of my modules, and it throws a Undefined function exception.
My best guess is that this is due to Drupal core system not being ready for function calls. I’ve looked all over and I can’t find any way to check when the core system is ready for function calls.
Do you have any suggestion?
The module uses require_once
to get the file with the function mentioned above.
The content of the file calling taxonomy_get_term_by_name()
is the following.
/**
* Implements hook_init().
*/
function functions_init()
{
get_tids();
}
function get_tids()
{
$terms = ['term1', 'term2', 'term3'];
foreach ($terms as $term) {
$result = taxonomy_get_term_by_name($term);
$GLOBALS[$term] = key($result);
}
}
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP