Get block position/size

Get block position/size

د Janith Weerasinghe لخوا -
د ځوابونو شمیر: 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!

د درجې بندۍ اوسط:  -
In reply to Janith Weerasinghe

Re: Get block position/size

د 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.