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