Skip to main content
4 votes
Accepted

How do I show a Garnish hud in the CP

I finally figured this out. I was actually close. Here's the HTML that I use <div class="hud-wrapper hidden"> <div id="generate-pdf-form" class="form meta"> <form> ...
Andreas's user avatar
  • 491
3 votes
Accepted

How can I submit a form from a Garnish HUD footer?

Since the shuffled markup is the root of the problem, one might follow examples from the Craft control panel source that serialize the form's data and submit via AJAX (and often $.proxy() to help with ...
Matt Stein's user avatar
  • 4,006
3 votes
Accepted

Craft 3 - custom callback after Garnish onDragStop

Garnish’s Base class introduces its own concept of events, that is separate from DOM events. Here’s how you’d set up the listener: // get the Craft.MatrixInput object var matrix = $('.matrix-field')....
Brandon Kelly's user avatar
3 votes
Accepted

Listen for checkbox check event for assets table and modify action trigger menu item

Here is one approach: Whenever an asset is checked on or off, it triggers a manipulation of the hidden ul.menu. You could listen for that update to be complete, then you’ll be able to access and hide ...
Vanessa Morato's user avatar
2 votes

How to create modals

Foud the answer after digging a bit, in fact I missed a little detail. The base javascript code was correct : $modal = new Garnish.Modal($('#my-modal')); //create a new modal $modal.show(); //shows ...
ovesco's user avatar
  • 271
2 votes

Javascript events when modal window is opened or closed

This is what I ended up doing: https://github.com/nystudio107/disclosedassets/blob/master/resources/js/disclosedassets.js There is a Garnish.Modal.visibleModal that will contain the handle to the ...
andrew.welch's user avatar
  • 11.6k
2 votes
Accepted

How can I use asset select modal in utility?

The field is just a normal ElementSelect field with the element type craft\\elements\\Asset {{ forms.elementSelectField({ label: "Asset"|t('app'), id: 'assetSelect', name: 'assetSelect', ...
Robin Schambach's user avatar
2 votes
Accepted

Plugin field-type not getting javascript variable?

Keep in mind Craft parses the html of your field, it won't be used directly, thus the ID of your field can't be "#"+startDateFieldHandleunless you ignored Crafts methods or modified it in another way. ...
Robin Schambach's user avatar
2 votes
Accepted

How to access Craft.EditableTable instance in CraftCM

So, after fiddling with it for a while, this is what I came up with it: When using forms.editableTable make sure you don't initialize Craft.EditableTable. You can do that by setting the initJs to ...
Rodrigo Passos's user avatar
1 vote
Accepted

How to make checkboxSelectField sortable?

Here is the solution: var $rows = $('#YOUR_FIELD_ID') .children('.input .ltr').children('.checkbox-select').children(); new Garnish.DragSort($rows, { axis: 'y', magnetStrength: 4, ...
antdev's user avatar
  • 137
1 vote
Accepted

Garnish event when changing category group

Craft.elementIndex.on('selectSource', function(){ alert('changed the source'); }); Craft.elementIndex contains the plugin for all index pages, that means all entries as well as users and ...
Robin Schambach's user avatar
1 vote

Craft 3 js - extend the field layout designer field settings

If someone has a better approach to solve that please tell me because my method right now fells really wrong and like a hack that might be troublesome in the future. I would like to accept the answer ...
Robin Schambach's user avatar
1 vote
Accepted

Javascript events when modal window is opened or closed

It looks as if there is no clean way to do this. The solution I am using to detect a new modal is detect double click on the element wait a second until the modal has opened find the modal which is ...
Marion Newlevant's user avatar

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