Skip to content

Commit

Permalink
Method to return the current page the block is shown on
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasbnielsen committed Nov 1, 2016
1 parent 1536e65 commit ed4be72
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions code/dataobjects/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,4 +411,15 @@ public function FormattedBlockImage($img_id, $width, $height)

return $img->$method($width, $height);
}

/**
* Returns the page object (SiteTree) that we are currently on
* Allow us to loop on children of the page and other page related data
*
* @return SiteTree
*/
public function CurrentPage()
{
return Director::get_current_page();
}
}

0 comments on commit ed4be72

Please sign in to comment.