You are here

function shorten_block in Shorten URLs 6

Implementation of hook_block().

File

./shorten.module, line 73
Shortens URLs via external services.

Code

function shorten_block($op = 'list', $delta = 0, $edit = array()) {
  if ($op == 'list') {
    $block['shorten']['info'] = t('Shorten URLs');
    $block['shorten']['visibility'] = 0;
    $block['shorten']['pages'] = 'shorten';
    $block['shorten_short']['info'] = t('Short URL');
    $block['shorten_short']['cache'] = BLOCK_CACHE_PER_PAGE;
    return $block;
  }
  elseif ($op == 'view' && $delta == 'shorten') {
    $block['subject'] = t('Shorten URLs');
    $block['content'] = shorten_form_display();
    return $block;
  }
  elseif ($op == 'view' && $delta == 'shorten_short') {
    $block['subject'] = t('Short URL');
    $block['content'] = drupal_get_form('shorten_current');
    return $block;
  }
  elseif ($op == 'configure' && $delta == 'shorten_short') {
    drupal_set_message(t('This block displays the short URL for the page on which it is shown, which can slow down uncached pages in some instances.'));
  }
}