I created a new custom action.

A new button is added in getAvailableActions() as we can se in below screenshot in red marked rectangle, now when i click on that button (Cusotm Action) i want to open a pop up box ( i used Default pop up js lib.


Template File path : /craft/plugins/tagmanager/templates/_mergetags.twig

{% includeJsResource "tagmanager/js/tagmanager.js" %}

    <div class="btn menubtn btnMeregeTags" role="button">{{ "Merge Tags"|t }}</div>
    <div class="menu">
    <div id="mergetags-modal" class="modal"> 
        <div id="modal" class="body">
            <header class="header">
                <h2>Modal header</h2>

js part

$(function () {
  $modal = new Garnish.Modal($('#mergetags-modal')); //create a new modal

default pop up

Not able to open pop up correctly.

Thank you.


I'm not sure what your Question is exactly and what your expected outcome is but to create a Modal you can use this HTML

<div id="my-awesome-modal" class="modal">
    <div id="modal-body" class="body">
        <header class="header">
            <h2>My Awesome Modal</h2>

and via JavaScript you can show it

//create it
var modal = new Garnish.Modal($('#my-awesome-modal')); 
  • I am not able to add any js event on my custom button which is created by adding a new action – inrsaurabh Feb 23 '19 at 18:21
  • 1
    Why are you not able to do that? – Robin Schambach Feb 23 '19 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.