Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I'm trying to load the TinyButStrong library into my custom module, but it won't get loaded.
The hook libraries_load returns an array but the key 'loaded' is set to 0.
When I execute the hook_libraries_detect everything looks fine and the key 'installed' is set to TRUE.
The original TinyButStrong library is placed in sites/all/libraries into the folder 'tbs_us'.
function stapp_documents_libraries_info() {
// A very simple library. No changing APIs (hence, no versions), no variants.
// Expected to be extracted into 'sites/all/libraries/simple'.
$libraries['tbs_us'] = array(
'name' => 'TinyButStrong',
'vendor url' => 'http://example.com/simple',
'download url' => 'http://example.com/simple',
'version callback' => 'stapp_documents_version_callback',
'files' => array(
'php' => array('tbs_us.php'), //this can be a path to the file location like array('lib/simple.js')
),
);
return $libraries;
}
function stapp_documents_version_callback() {
//use some fancy magic to get the version number... or don't
return TRUE;
}
function stapp_documents_documents_page() {
$name = 'tbs_us';
if (($library = libraries_detect($name)) && !empty($library['installed'])) {
dpm('The library is installed. Awesome!');
// Try to load the library and check if that worked.
if (($library = libraries_load($name)) && !empty($library['loaded'])) {
dpm('The library is loaded. Awesome!');
}
}
else {
$error = $library['error'];
// This contains a detailed (localized) error message.
$error_message = $library['error message'];
dpm($error);
dpm($error_message);
}
//require_once(DRUPAL_ROOT . '/sites/all/libraries/tbs_us/tbs_class.php');
//$tbs = new clsTinyButStrong; dpm($tbs);
return 'documents';
}
Thanks in advance.
P.S. Regular require_once does work