Skip to main content

Questions tagged [garnish]

The Javascript UI library used by Craft.

Filter by
Sorted by
Tagged with
1 vote
1 answer
36 views

How to make checkboxSelectField sortable?

i am trying to make checkboxSelectField sortable so far i have only managed with inclusion of third party scripts (sortable in jquery.ui). The code looks like this: Twig: {% import "_includes/...
antdev's user avatar
  • 149
1 vote
0 answers
70 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 ...
ijust's user avatar
  • 163
1 vote
1 answer
205 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?
yu xia's user avatar
  • 397
1 vote
1 answer
232 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) ...
kr37's user avatar
  • 1,355
1 vote
1 answer
201 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 ...
Trevor Davis's user avatar
2 votes
1 answer
351 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 ...
Robin Schambach's user avatar
1 vote
1 answer
506 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'...
Robin Schambach's user avatar
2 votes
1 answer
177 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 ...
Rodrigo Passos's user avatar
5 votes
1 answer
220 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 ...
Matt Stein's user avatar
  • 4,006
4 votes
1 answer
426 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 ...
Andreas's user avatar
  • 491
6 votes
2 answers
10k 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.
Marion Newlevant's user avatar
3 votes
0 answers
141 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&...
Jacob's user avatar
  • 282
3 votes
1 answer
322 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 ...
Brad's user avatar
  • 487
2 votes
1 answer
2k 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 ...
ovesco's user avatar
  • 271
2 votes
1 answer
2k 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 ...
Ben Parizek's user avatar
  • 13.5k
1 vote
1 answer
257 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 ...
a-am's user avatar
  • 2,867
2 votes
1 answer
349 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-...
Mats Mikkel Rummelhoff's user avatar
3 votes
2 answers
748 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 ...
Sam Hibberd's user avatar
2 votes
1 answer
396 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?
TJ Draper's user avatar
  • 153
3 votes
1 answer
174 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?
Lindsey D's user avatar
  • 24.1k
4 votes
3 answers
2k 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 ...
Mats Mikkel Rummelhoff's user avatar
3 votes
2 answers
200 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 ...
Peter Tell's user avatar
  • 1,838
7 votes
1 answer
557 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:...
Keith Mancuso's user avatar
2 votes
1 answer
584 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 ...
Adam McCombs's user avatar
  • 1,695
2 votes
1 answer
663 views

Any documentation about the elementindex template available?

I'm trying to customise the elementindex view. For example I want to filter out some entries that don't match certain criteria. Also if possible add some hooks to the read calls. Is there any ...
pythic's user avatar
  • 569
4 votes
1 answer
542 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?
Jason McCallister's user avatar
2 votes
1 answer
114 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 ...
Lindsey D's user avatar
  • 24.1k
23 votes
1 answer
2k 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". ...
Lindsey D's user avatar
  • 24.1k