You are here

function route_planner_block in Route Planner 6

Implementation of hook_block().

File

./route_planner.module, line 31
The Route Planner module create blocks to show a route from any address to a fixed point.

Code

function route_planner_block($op = 'list', $delta = 0, $edit = array()) {
  $blocks = array(
    'route_target' => array(
      'info' => t('Route Planner Address Field'),
      'cache' => BLOCK_NO_CACHE,
    ),
    'map' => array(
      'info' => t('Route Planner Map Display'),
      'cache' => BLOCK_NO_CACHE,
    ),
  );
  switch ($op) {

    // Block listing
    case 'list':
      return $blocks;

    // Block viewing
    case 'view':

      // By default the block subject equals block info
      $block['subject'] = $blocks[$delta]['info'];
      switch ($delta) {
        case 'route_target':
          $block['content'] = route_planner_get_address_form();
          break;
        case 'map':
          $block['content'] = route_planner_map_display();
          break;
      }
      return $block;
  }
}