New answers tagged

3

So the way Twig works is that it populates a Twig Environment with a context of global variables. Then any time a template includes another template, the context is passed down to it. So if you want something to be globally available you have to insert it into the Twig environment before Twig is used, for it to be truly globally available. You can do that ...


2

those CP files are included by CpAsset asset bundle. if your plugin asset bundle depends on CpAsset: class YourPluginAsset extends AssetBundle { public function init() { $this->sourcePath = __DIR__ . '/dist'; $this->depends = [ CpAsset::class, ] //.... } } and if you register your plugin asset in ...


2

UIDs are not yet usable in queries. You would need to extract the UID of the section from the string then fetch the sectionId to use in your query. Something like this: {% for tab in entry.fieldLayout.tabs %} {{ tab.name }} {% for field in tab.getFields() %} <label for="{{ field.handle }}">{{ field.name }}</label> <br> ...


Top 50 recent answers are included