Get block position/size

Get block position/size

by Janith Weerasinghe -
Number of replies: 1

Hi,

Is there any way to know the block position where it will be displayed? Basically I want to change my block's content based on where it will be displayed. (Lengthy text if its displayed on the center part of my home, or shorter text if displayed on a side)

Im developing the block for Moodle 2.0

Thank you!

Average of ratings: -
In reply to Janith Weerasinghe

Re: Get block position/size

by Akinsaya Delamarre -

In your code look at $this->instance->region.

If the block is displayed on the left side the region property is 'side-pre'.  If in the center it is 'content'. If on the right side it is 'side-post.