Text cleanup.
[project/addthis.git] / includes / addthis.block.inc
1 <?php
2
3 /**
4 * @file
5 * Block related hook implementations for the AddThis-module.
6 */
7
8 /**
9 * Implements hook_block_info().
10 */
11 function addthis_block_info() {
12 $block_info = array();
13 $block_info[AddThis::BLOCK_NAME] = array(
14 'info' => t('AddThis'),
15 'cache' => DRUPAL_NO_CACHE,
16 );
17 return $block_info;
18 }
19
20 /**
21 * Implements hook_block_view().
22 *
23 * #block key allows alter hooks to react on this information. Someone might
24 * want to change this specific display.
25 */
26 function addthis_block_view($block_name = '') {
27 if ($block_name == AddThis::BLOCK_NAME) {
28 $widget_type = AddThis::getInstance()->getBlockDisplayType();
29 $markup = AddThis::getInstance()->getDisplayMarkup($widget_type, array('#block' => AddThis::BLOCK_NAME));
30 return array(
31 'subject' => '',
32 'content' => $markup,
33 );
34 }
35 }
36
37 /**
38 * Implements hook_block_configure().
39 */
40 function addthis_block_configure($delta = '') {
41 $form[AddThis::BLOCK_WIDGET_TYPE_KEY] = array(
42 '#type' => 'select',
43 '#title' => t('AddThis display type'),
44 '#options' => AddThis::getInstance()->getDisplayTypes(),
45 '#default_value' => AddThis::getInstance()->getBlockDisplayType(),
46 );
47 return $form;
48 }
49
50 /**
51 * Implements hook_block_save().
52 */
53 function addthis_block_save($delta = '', $edit = array()) {
54 variable_set(AddThis::BLOCK_WIDGET_TYPE_KEY, $edit[AddThis::BLOCK_WIDGET_TYPE_KEY]);
55 }