Hot answers tagged

3

For the second part of your question, look into Element Sources. You might be able to pull off something fancy in a module, where certain users have access to different sources. For the first part of your question, look into the EVENT_REGISTER_TABLE_ATTRIBUTES and EVENT_SET_TABLE_ATTRIBUTE_HTML events. Here is a rough example of how it will look... // Add ...


2

There's an easier way... Twig has a built-in variable in for-loops called loop, which has loop.index and loop.index0 properties which output exactly what you're looking for: https://twig.symfony.com/doc/3.x/tags/for.html#the-loop-variable {% for project in sliderWork %} <div class="progress__wrap"> <span data-slick-index="{{ ...


1

Since this is a module rather than a plugin, you need to register control panel template roots, like so: Event::on( View::class, View::EVENT_REGISTER_CP_TEMPLATE_ROOTS, function (RegisterTemplateRootsEvent $e) { $e->roots['app-module'] = __DIR__ . '/templates/cp'; } ); (I've swapped 'custom' for 'app-module' as I think it's a ...


1

I have managed to figure it out. I will use the following and it seems to work fine {% set indexCounter = ( counter | default(0) ) %} {% set counter = ( counter | default(0) ) + 1 %} Hope this can be of help to someone.


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