original_string: public function blocks_for_region($region) {
          $blockcontents = $this->page->blocks->get_content_for_region($region, $this);
          $blocks = $this->page->blocks->get_blocks_for_region($region);
          $lastblock = null;
          $zones = array();
          foreach ($blocks as $block) {
              $zones[] = $block->title;
          }
          $output = '';
  
          foreach ($blockcontents as $bc) {
              if ($bc instanceof block_contents) {
                  $output .= $this->block($bc, $region);
                  $lastblock = $bc->title;
              } else if ($bc instanceof block_move_target) {
                  $output .= $this->block_move_target($bc, $zones, $lastblock, $region);
              } else {
                  throw new coding_exception('Unexpected type of thing (' . get_class($bc) . ') found in list of block contents.');
              }
          }
          return $output;
      }
code: public function blocks_for_region($region) {
          $blockcontents = $this->page->blocks->get_content_for_region($region, $this);
          $blocks = $this->page->blocks->get_blocks_for_region($region);
          $lastblock = null;
          $zones = array();
          foreach ($blocks as $block) {
              $zones[] = $block->title;
          }
          $output = '';
  
          foreach ($blockcontents as $bc) {
              if ($bc instanceof block_contents) {
                  $output .= $this->block($bc, $region);
                  $lastblock = $bc->title;
              } else if ($bc instanceof block_move_target) {
                  $output .= $this->block_move_target($bc, $zones, $lastblock, $region);
              } else {
                  throw new coding_exception('Unexpected type of thing (' . get_class($bc) . ') found in list of block contents.');
              }
          }
          return $output;
      }
code_tokens: public function blocks_for_region ( $ region ) { $ blockcontents = $ this -> page -> blocks -> get_content_for_region ( $ region , $ this ) ; $ blocks = $ this -> page -> blocks -> get_blocks_for_region ( $ region ) ; $ lastblock = null ; $ zones = array ( ) ; foreach ( $ blocks as $ block ) { $ zones [ ] = $ block -> title ; } $ output = '' ; foreach ( $ blockcontents as $ bc ) { if ( $ bc instanceof block_contents ) { $ output .= $ this -> block ( $ bc , $ region ) ; $ lastblock = $ bc -> title ; } else if ( $ bc instanceof block_move_target ) { $ output .= $ this -> block_move_target ( $ bc , $ zones , $ lastblock , $ region ) ; } else { throw new coding_exception ( 'Unexpected type of thing (' . get_class ( $ bc ) . ') found in list of block contents.' ) ; } } return $ output ; }
docstring: Output all the blocks in a particular region.
  
  @param string $region the name of a region on this page.
  @return string the HTML to be output.
docstring_tokens: Output all the blocks in a particular region .