You are here

function feedapi_block in FeedAPI 6

Same name and namespace in other branches
  1. 5 feedapi.module \feedapi_block()

Implementation of hook_block().

File

./feedapi.module, line 205
Handle the submodules (for feed and item processing) Provide a basic management of feeds

Code

function feedapi_block($op = 'list', $delta = 0) {
  $blocks = array();
  $names = feedapi_get_types();
  switch ($op) {
    case 'list':
      foreach ($names as $type => $name) {
        $blocks[$type]['info'] = t('FeedAPI: Quick create !preset', array(
          '!preset' => $name,
        ));
        $blocks[$type]['cache'] = BLOCK_CACHE_GLOBAL;
      }
      break;
    case 'view':
      if (node_access('create', $delta)) {
        $blocks['subject'] = t('Create !preset', array(
          '!preset' => $names[$delta],
        ));
        $blocks['content'] = drupal_get_form('feedapi_simplified_form', $delta);
      }
      break;
  }
  return $blocks;
}