i-lateral /
silverstripe-deferedimages
| 1 | <?php |
||
| 2 | |||
| 3 | namespace ilateral\SilverStripe\DeferedImages; |
||
| 4 | |||
| 5 | use SilverStripe\Core\Extension; |
||
| 6 | use SilverStripe\View\Requirements; |
||
| 7 | use SilverStripe\Core\Config\Config; |
||
| 8 | |||
| 9 | class ControllerExtension extends Extension |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * should the javascript be added via requirements |
||
| 13 | * |
||
| 14 | * @config |
||
| 15 | * @var boolean |
||
| 16 | */ |
||
| 17 | private static $load_script = true; |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 18 | |||
| 19 | public function onAfterInit() |
||
| 20 | { |
||
| 21 | if (Config::inst()->get(static::class, 'load_script')) { |
||
| 22 | Requirements::javascript('i-lateral/silverstripe-deferedimages:client/dist/js/deferedimages.min.js'); |
||
| 23 | } |
||
| 24 | } |
||
| 25 | } |