function hook_page_build in AddThis 7.4
Implements hook_page_build().
2 functions implement hook_page_build()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- addthis_page_build in ./
addthis.module - Implements hook_page_build().
- addthis_test_page_build in addthis_test/
addthis_test.module - Implements hook_page_build().
File
- ./
addthis.example.php, line 6
Code
function hook_page_build(&$page) {
// Load the scripts on a specific url or other case when you don't use the
// Field API or Block.
if (current_path() == 'node/1') {
$manager = AddThisScriptManager::getInstance();
// Adjust domready and async settings for this page.
//
// NOTE! that on pages where these settings are altered and attach is called
// more then once but not altered he second time, you will get conflicts.
// The widget js will be loaded multiple times with different settings.
// So choose wisely!
//
$manager
->setAsync(FALSE);
$manager
->setDomReady(FALSE);
// Using $page['content'] or other area is neccesary because otherwise
// #attached does not work. You can not attach on $page directly.
$manager
->attachJsToElement($page['content']);
}
}