Source of file ChecExtension.php
Size: 0,967 Bytes - Last Modified: 2021-12-23T10:19:10+00:00
/var/www/docs.ssmods.com/process/src/src/ChecExtension.php
1234567891011121314151617181920212223242526272829303132333435 | <?php namespace Robbie\SilverstripeChec; use SilverStripe\CMS\Model\SiteTreeExtension; use SilverStripe\View\Requirements; class ChecExtension extends SiteTreeExtension { /** * Loads the third party JavaScript during Controller->init() */ public function contentcontrollerInit(): void { if ($jsPath = ChecShortcode::config()->get('javascript_url')) { Requirements::javascript($jsPath); } } /** * Tries to fetch the inline Chec JS from cache, failing which it gets it from the URL. * Should your theme clear requirements, placing this before the closing body tag ensures * that it always gets loaded. * * @return string */ public function getChecJavaScript(): string { if ($jsPath = ChecShortcode::config()->get('javascript_url')) { return sprintf('<script type="text/javascript" src="%s"></script>', $jsPath); } return ''; } } |