protected function create_block_contents($instances, $output, $region) {
        $results = array();

        $lastweight = 0;
        $lastblock = 0;
        if ($this->movingblock) {
            $first = reset($instances);
            if ($first) {
                $lastweight = $first->instance->weight - 2;
            }
        }

        foreach ($instances as $instance) {
            $content = $instance->get_content_for_output($output);
            if (empty($content)) {
                continue;
            }

            if ($this->movingblock && $lastweight != $instance->instance->weight &&
                    $content->blockinstanceid != $this->movingblock && $lastblock != $this->movingblock) {
                $results[] = new block_move_target($this->get_move_target_url($region, ($lastweight + $instance->instance->weight)/2));
            }

            if ($content->blockinstanceid == $this->movingblock) {
                $content->add_class('beingmoved');
                $content->annotation .= get_string('movingthisblockcancel', 'block',
                        html_writer::link($this->page->url, get_string('cancel')));
            }

            $results[] = $content;
            $lastweight = $instance->instance->weight;
            $lastblock = $instance->instance->id;
        }

        if ($this->movingblock && $lastblock != $this->movingblock) {
            $results[] = new block_move_target($this->get_move_target_url($region, $lastweight + 1));
        }
        return $results;
    }
protected function create_block_contents($instances, $output, $region) {
        $results = array();

        $lastweight = 0;
        $lastblock = 0;
        if ($this->movingblock) {
            $first = reset($instances);
            if ($first) {
                $lastweight = $first->instance->weight - 2;
            }
        }

        foreach ($instances as $instance) {
            $content = $instance->get_content_for_output($output);
            if (empty($content)) {
                continue;
            }

            if ($this->movingblock && $lastweight != $instance->instance->weight &&
                    $content->blockinstanceid != $this->movingblock && $lastblock != $this->movingblock) {
                $results[] = new block_move_target($this->get_move_target_url($region, ($lastweight + $instance->instance->weight)/2));
            }

            if ($content->blockinstanceid == $this->movingblock) {
                $content->add_class('beingmoved');
                $content->annotation .= get_string('movingthisblockcancel', 'block',
                        html_writer::link($this->page->url, get_string('cancel')));
            }

            $results[] = $content;
            $lastweight = $instance->instance->weight;
            $lastblock = $instance->instance->id;
        }

        if ($this->movingblock && $lastblock != $this->movingblock) {
            $results[] = new block_move_target($this->get_move_target_url($region, $lastweight + 1));
        }
        return $results;
    }
protected function create_block_contents ( $ instances , $ output , $ region ) { $ results = array ( ) ; $ lastweight = 0 ; $ lastblock = 0 ; if ( $ this -> movingblock ) { $ first = reset ( $ instances ) ; if ( $ first ) { $ lastweight = $ first -> instance -> weight - 2 ; } } foreach ( $ instances as $ instance ) { $ content = $ instance -> get_content_for_output ( $ output ) ; if ( empty ( $ content ) ) { continue ; } if ( $ this -> movingblock && $ lastweight != $ instance -> instance -> weight && $ content -> blockinstanceid != $ this -> movingblock && $ lastblock != $ this -> movingblock ) { $ results [ ] = new block_move_target ( $ this -> get_move_target_url ( $ region , ( $ lastweight + $ instance -> instance -> weight ) / 2 ) ) ; } if ( $ content -> blockinstanceid == $ this -> movingblock ) { $ content -> add_class ( 'beingmoved' ) ; $ content -> annotation .= get_string ( 'movingthisblockcancel' , 'block' , html_writer :: link ( $ this -> page -> url , get_string ( 'cancel' ) ) ) ; } $ results [ ] = $ content ; $ lastweight = $ instance -> instance -> weight ; $ lastblock = $ instance -> instance -> id ; } if ( $ this -> movingblock && $ lastblock != $ this -> movingblock ) { $ results [ ] = new block_move_target ( $ this -> get_move_target_url ( $ region , $ lastweight + 1 ) ) ; } return $ results ; }
Return an array of content objects from a set of block instances

@param array $instances An array of block instances
@param renderer_base The renderer to use.
@param string $region the region name.
@return array An array of block_content (and possibly block_move_target) objects.
Return an array of content objects from a set of block instances