Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [garnish]

The Javascript UI library used by Craft.

Filter by
Sorted by
Tagged with
1
vote
0answers
46 views

Pre-select entry type based on site being edited

I'd like to change the entry type that's pre-selected when creating a new entry depending on the site that's being edited (doing that with JS). In control panel, does anyone know how I can trigger the ...
1
vote
1answer
89 views

How can I use asset select modal in utility?

I created a custom utility template. Inside the template, I would like to use the built-in asset select modal for the "Add image" button. Any way to do this please?
2
votes
1answer
256 views

How can I use Garnish to sort?

I am working on a field type that is similar to the table field type. Is it possible to tap into Garnish for the sorting. I’ve tried a few things and have had no luck. Can anyone help me out?
1
vote
1answer
81 views

Plugin field-type not getting javascript variable?

Updating a plugin from Craft 2 to Craft 3, so this logic used to work. The plugin has a field-type which is a button. When clicked, the button does stuff depending upon another field. That handle(ID) ...
1
vote
1answer
84 views

Garnish event when changing category group

When I am on the categories index (admin/categories), is there a Garnish event that fires when you select a different category group in the sidebar? I want to add some custom JS after the AJAX request ...
2
votes
1answer
217 views

Craft 3 js - extend the field layout designer field settings

I would like to have the ability to include a custom option in the field layout designer field settings. There is already a plugin for Craft 2 that uses this feature Relabel for Craft And I would ...
1
vote
1answer
213 views

Craft 3 - custom callback after Garnish onDragStop

I would like to trigger a custom javascript function after an element in a matrix block was moved in the matrix but I'm not sure how to attach the event without changing the MatrixInput.js. So far I'...
1
vote
1answer
91 views

How to access Craft.EditableTable instance in CraftCM

I am developing a custom plugin that has a variable setting that can take multiple options. I've decided to use forms.editableTable from Craft's _includes/forms. It does the job great, saving and ...
6
votes
2answers
1k views

Javascript events when modal window is opened or closed

How can I detect when a modal window has been opened or closed? I am writing a plugin which wants to detect when a garnish elementeditor modal window has been opened or closed.
4
votes
1answer
157 views

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

I'm working on a Dashboard widget from which users can submit entries for review from a Garnish HUD, like so... I've started by placing a hidden form next to each little Submit button... <form ...
4
votes
1answer
226 views

How do I show a Garnish hud in the CP

I've written a custom plugin and added a custom button to the right panel of an entry page Now I'm trying to show a Garnish Hud if I click the red button (like the one when you re-index assets) The ...
1
vote
1answer
924 views

How to create modals

I just want to create a modal and play with it, but can't find a way to do so. I already checked other questions on the subject, but I still can't figure why my modal isn't showing correctly. Here is ...
23
votes
1answer
1k views

How can my plugin generate a generic modal window in the Control Panel?

I'm working on a plugin, and it requires a modal to be displayed when the user interacts with a field of my Field Type. When the user finishes interacting with the modal, they would click "Done". ...
3
votes
0answers
116 views

How can my plugin use Craft's native dragdrop support

I am using a generic Garnish modal from Craft like so: $container = $('.upload-modal'); $modal = new Garnish.Modal($container, { autoShow: false }); I would like to have craft's native drag&...
3
votes
1answer
272 views

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

I am able to listen to an event when the user checks the checkbox in the assets table. This is within my js file init file that extends garnish: Garnish.Base.extend When the checkbox is selected, I ...
2
votes
1answer
806 views

Error: Invalid negative value for <rect> attribute

I'm trying to create a dashboard widget using the new Craft charting library. I'm more or less copying the New Users widget however I'm running into an issue where my container does not seem to be ...
1
vote
1answer
154 views

When using “createElementSelectorModal()” how do you respect selected locale?

When using createElementSelectorModal() in a plugin, how do you make your source list show items from the current locale selected in the CP? It only seems to show the items from default locale no ...
3
votes
1answer
153 views

Garnish - Event when selecting a category

I have a "Categories" field in my section. I want to perform some JavaScript actions when a category is selected. Is there any built-in event which will be triggered at that point?
2
votes
1answer
190 views

Setting selected elements in a BaseElementSelectorModal (or BaseElementIndex)

I'm writing a Javascript based plugin which creates an instance of Craft.BaseElementSelectorModal. When the modal is created, I'd like to have some of the entries in the modal's element index auto-...
3
votes
2answers
464 views

Access add and remove events with the Craft Element Selector?

Is there any way to access an event, and trigger some function, when an element is added / removed with the Craft Element Selector logic available in Garnish? I am working on a custom field type and ...
3
votes
2answers
147 views

Is there an accessible callback when Craft.EntryTypeSwitcher is run?

When a user switches Entry Types in the control panel, Craft.EntryTypeSwitcher is trigged which in turn triggers onTypeChange. Is there callback that a plugin can access to run some additional ...
4
votes
3answers
1k views

JS templating in Craft CP

I'm writing a plugin where I need to render some semi-complex HTML clientside at runtime (all inside the CP). Does Garnish (or any other library/framework/JS-thingamabob shipped with Craft) offer any ...
6
votes
1answer
429 views

Filtering and sorting lists in a plugin

Whats the recommended way to have javascript based filtering and sort table views in a plugin tab? Is is possible to use garnish to do that or should we be looking at external libraries like: http:...
2
votes
1answer
406 views

Possible to override Garnish.Modal? [Plugin]

Is there a way to override Garnish.Modal? For example, I have a custom modal which uses a custom form but I want to be able to use the built in forms.elementSelect to select from a user list. When I ...
4
votes
1answer
436 views

Can Garnish be extended to allow plugins to use custom keyboard shortcuts?

For example, when editing an entry cmd + s saves the entry. Is there an easy way to extend Garnish to allow for my plugin to listen for custom keyboard shortcuts?
2
votes
1answer
92 views

Is this Garnish message bad? “Element was added to more than one selector”

My plugin has a field type. When I'm editing an entry which uses that field type, this message gets logged to the console: Element was added to more than one selector I can tell that it's Garnish ...