4

You can do this using PhpStorm’s Language Injections feature. In fact, as of PhpStorm 2017.3, it has included support for {% script %} tags out of the box. To extend that to {% js %} tags, go to Preferences → Editor → Language Injections, and search for “twig: custom statement javascript”. Double-click on it to edit it, and add the following line to the ...


2

I would use a macro to output the contents of a single nugget (matrix block), this way you don't have to repeat the include statement multiple times. The only thing you need to keep track of is the current index, i.e. which item is next. You can't do this inside the macro, since a macro can't have persistent state. You have two options: Set up a variable to ...


2

I know this is an old question, but just an update: If you're on Craft CMS v3+, craft.config.[setting-name] has been deprecated. Use craft.app.config.general.[setting-name] instead. So if you wanted to check if you were in dev environment, you'd do craft.app.config.general.devMode, this returns a boolean value.


2

This is a change in behaviour from Craft 2 to Craft 3 and here is the explanation. In short, you need to clone your query (docs), something like the below should work: {# Initiate your query #} {% set content = entry.pageBuilder %} {# Clone the original query to get your blurb #} {% set blurb = clone(content).type('copy,faq').limit(1).all() %} {# Get ...


1

Duplicate of https://github.com/putyourlightson/craft-sprig/issues/118 The code is correct and what you are experiencing is likely due to local browser caching.


Only top voted, non community-wiki answers of a minimum length are eligible