root / drupal7 / sites / all / modules / addthis / addthis.example.php @ ebcc4118
1 | 2c8c2b87 | Assos Assos | <?php
|
---|---|---|---|
2 | |||
3 | /**
|
||
4 | * Implements hook_page_build().
|
||
5 | */
|
||
6 | function hook_page_build(&$page) { |
||
7 | |||
8 | // Load the scripts on a specific url or other case when you don't use the
|
||
9 | // Field API or Block.
|
||
10 | if (current_path() == 'node/1') { |
||
11 | $manager = AddThisScriptManager::getInstance(); |
||
12 | |||
13 | // Adjust domready and async settings for this page.
|
||
14 | //
|
||
15 | // NOTE! that on pages where these settings are altered and attach is called
|
||
16 | // more then once but not altered he second time, you will get conflicts.
|
||
17 | // The widget js will be loaded multiple times with different settings.
|
||
18 | // So choose wisely!
|
||
19 | //
|
||
20 | $manager->setAsync(FALSE); |
||
21 | $manager->setDomReady(FALSE); |
||
22 | |||
23 | // Using $page['content'] or other area is neccesary because otherwise
|
||
24 | // #attached does not work. You can not attach on $page directly.
|
||
25 | $manager->attachJsToElement($page['content']); |
||
26 | } |
||
27 | } |