| 1 | <?php |
||
| 3 | namespace SheaDawson\Blocks\extensions; |
||
| 4 | |||
| 5 | use SilverStripe\View\Requirements; |
||
| 6 | use SilverStripe\Core\Extension; |
||
| 7 | |||
| 8 | class BlocksContentControllerExtension extends Extension |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var array |
||
| 12 | */ |
||
| 13 | private static $allowed_actions = array( |
||
|
|
|||
| 14 | 'handleBlock', |
||
| 15 | ); |
||
| 16 | |||
| 17 | public function onAfterInit() |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Handles blocks attached to a page |
||
| 28 | * Assumes URLs in the following format: <URLSegment>/block/<block-ID>. |
||
| 29 | * |
||
| 30 | * @return RequestHandler |
||
| 31 | */ |
||
| 32 | public function handleBlock() |
||
| 33 | { |
||
| 34 | if ($id = $this->owner->getRequest()->param('ID')) { |
||
| 35 | $blocks = $this->owner->data()->getBlockList(null, true, true, true); |
||
| 36 | if ($block = $blocks->find('ID', $id)) { |
||
| 37 | return $block->getController(); |
||
| 38 | } |
||
| 39 | } |
||
| 44 |
This check marks private properties in classes that are never used. Those properties can be removed.