Removed legacy display types. Redesigned the config page.
[project/addthis.git] / includes / addthis.block.inc
... / ...
CommitLineData
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() {
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 */
23function addthis_block_view($block_name = '') {
24 if ($block_name == AddThis::BLOCK_NAME) {
25 $widget_type = AddThis::getInstance()->getBlockDisplayType();
26 $markup = AddThis::getInstance()->getDisplayMarkup($widget_type);
27 return array(
28 'subject' => '',
29 'content' => $markup,
30 );
31 }
32}
33
34/**
35 * Implements hook_block_configure().
36 */
37function addthis_block_configure($delta = '') {
38 $form[AddThis::BLOCK_WIDGET_TYPE_KEY] = array(
39 '#type' => 'select',
40 '#title' => t('AddThis Display type'),
41 '#options' => AddThis::getInstance()->getDisplayTypes(),
42 '#default_value' => AddThis::getInstance()->getBlockDisplayType(),
43 );
44 return $form;
45}
46
47/**
48 * Implements hook_block_save().
49 */
50function addthis_block_save($delta = '', $edit = array()) {
51 variable_set(AddThis::BLOCK_WIDGET_TYPE_KEY, $edit[AddThis::BLOCK_WIDGET_TYPE_KEY]);
52}