• Resolved taylormairglow

    (@taylormairglow)


    Hello. I’m trying to add additional content inside the modal that opens up when a user adds a new layout to their page. I have Javascript ready to add html after the layout wrapper, but I can’t figure out where to add the JS to actually target the element.

    Right now I’m using a dynamic render field to output the JS onto the page itself, but I don’t believe the modal that pops up is actually part of the DOM, so I can’t target the element with JS in order to add the additional HTML.

    The div I’m looking to change is the one with these three classes.

    acfe-flex-container acfe-col-2 acfe-flex-thumbnails

    Any help would be appreciated. Thanks.

Viewing 1 replies (of 1 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback!

    You can use the acfe/modal/open ACF JS hook in order to add your own logic to any ACFE Modal, including the modal of the Flexible Content Select Layout feature.

    Note that this hook isn’t documented since it’s for advanced use usage. Usage example:

    acf.addAction('acfe/modal/open', function($modal, options){
        
        // check that the modal is the "Select Layout" modal of our flexible content
        // change 'my_flexible_content_name' with your flexible content field name
        if($modal.hasClass('acfe-modal-select-my_flexible_content_name')){
    
            // do something
            // add class to each layout items in modal
            $modal.find('li a').addClass('new-class');
    
        }
    
    });
    

    Note that you’ll have to use the acf/input/admin_enqueue_scripts PHP hook in order to correctly enqueue your JS script into the ACF/ACFE logic, and being able to use acf.addAction() (See documentation).

    Finally, you also have an another JS hook called acfe/modal/close for the Modal Close action if needed.

    Hope it helps!

    Have a nice day!

    Regards.

Viewing 1 replies (of 1 total)

The topic ‘Add Content After Flexible Content Thumbnails’ is closed to new replies.