root / drupal7 / sites / all / modules / addthis / addthis.api.php @ ba09eb79
1 | 85ad3d82 | Assos Assos | <?php
|
---|---|---|---|
2 | /**
|
||
3 | * @file
|
||
4 | * This is currently a stub file that will be used to describe the addthis
|
||
5 | * implementation API.
|
||
6 | */
|
||
7 | |||
8 | /**
|
||
9 | * Implements hook_TYPE_alter().
|
||
10 | *
|
||
11 | * @param array $options
|
||
12 | * $options contains an array with configurations settings for used in the
|
||
13 | * creation of the markup. The following elements may be in here.
|
||
14 | *
|
||
15 | * - '#entity_type': The entity type this markup is define when called by a
|
||
16 | * field.
|
||
17 | * - '#entity': Is the entity object when called by a field.
|
||
18 | * - '#display': Is always defined and provide all the formatter
|
||
19 | * configuration.
|
||
20 | * - '#url': The link to the entity when the entity has a url.
|
||
21 | */
|
||
22 | function hook_addthis_markup_options_alter(&$options) { |
||
23 | global $base_root; |
||
24 | |||
25 | // Change the url used on the share buttons.
|
||
26 | $options['#url'] = $base_root . request_uri(); |
||
27 | |||
28 | // To apply different service this to the block implementation try this.
|
||
29 | if (isset($options['#block']) && $options['#display']['type'] == 'addthis_basic_toolbox') { |
||
30 | |||
31 | // Change the var below to add other services.
|
||
32 | $displayed_services = 'twitter,google_plusone,facebook'; |
||
33 | $options['#display']['settings']['share_services'] = $displayed_services; |
||
34 | $options['#display']['settings']['buttons_size'] = AddThis::CSS_16x16; |
||
35 | |||
36 | } |
||
37 | } |
||
38 | |||
39 | /**
|
||
40 | * Implements hook_TYPE_alter().
|
||
41 | *
|
||
42 | * @param array $markup
|
||
43 | * $markup contains an array with the structure of the addthis markup.
|
||
44 | */
|
||
45 | function hook_addthis_markup_alter(&$markup) { |
||
46 | |||
47 | // Let's add a custom CSS class for given a particular design to our
|
||
48 | // twitter button, so we can change the look.
|
||
49 | if (!empty($markup['twitter'])) { |
||
50 | $markup['twitter']['#attributes']['class'][] = "custom_twitter_class"; |
||
51 | } |
||
52 | |||
53 | // Or change button size for Google +1 for example.
|
||
54 | if (!empty($markup['google_plusone'])) { |
||
55 | $markup['google_plusone']['#attributes']['g:plusone:size'] = 'small'; |
||
56 | } |
||
57 | } |
||
58 | 2c8c2b87 | Assos Assos | |
59 | /**
|
||
60 | * Implements hook_TYPE_alter().
|
||
61 | *
|
||
62 | * @param array $configuration.
|
||
63 | */
|
||
64 | function hook_addthis_configuration($configuration) { |
||
65 | |||
66 | if (isset($configuration['templates'])) { |
||
67 | $configuration['templates']['twitter'] = 'Hello on twitter.'; |
||
68 | } |
||
69 | |||
70 | if (isset($configuration['addthis_share'])) { |
||
71 | // Alter the share variable used for the javascript.
|
||
72 | } |
||
73 | } |