You are here

function shurly_service_block in ShURLy 6

Implements hook_block().

File

shurly_service/shurly_service.module, line 50
Link ShURLy functionalities to services module. @todo

Code

function shurly_service_block($op = 'list', $delta = 0, $edit = array()) {

  // create a block to add URL
  switch ($op) {
    case 'list':
      $blocks['api_key'] = array(
        'info' => t('Short URL API key'),
      );
      return $blocks;
    case 'view':
      global $user;

      // anon user can't get API key, also check permissions
      if ($delta == 'api_key' && $user->uid > 0 && user_access('Create short URLs')) {
        $block = array(
          'subject' => t('API key'),
          'content' => drupal_get_form('shurly_api_key_form'),
        );
        return $block;
      }
      break;
  }
}