- Get module instance:
BlahModule::getInstance()
orBlahModule::$instance
- Get module service instance:
BlahModule::getInstance()->myService
orBlahModule::$instance->myService
- Access module variable in twig:
{{ craft.blahModule.someVar }}
or{{ craft.blahModule.someVar(params) }}
Get globals set:
Craft::$app->globals
Craft::$app->globals->getSetByHandle('setHandle');
To get the Sites service:
Craft::$app->getSites()
--or--
Craft::$app->sites
Then use the API: https://docs.craftcms.com/api/v3/craft-services-sites.html#public-methods
Craft::$app->sites->currentSite
Craft::$app->sites->getSiteByHandle('bdvs');
Craft::$app->sites->getSiteById(3);
See https://docs.craftcms.com/api/v3/craft-services-path.html#public-methods
Craft::$app->path->getSiteTemplatesPath()
{{ currentSite.id }}
{{ currentSite.handle }}
{{ currentSite.name }}
{{ currentSite.language }}
{{ currentSite.primary }}
{{ currentSite.baseUrl }}
craft.app.request.getParam('someParam')
Use getRawSql()
e.g. craft.entries({ section: 'artists' }).getRawSql()
See https://craftcms.stackexchange.com/questions/18491/dump-sql-query-in-twig-template