Home Forums ACF PRO JavaScript API – Modifying a Field model's function


JavaScript API – Modifying a Field model's function

    • gavin310

    • September 15, 2020 at 1:22 am

    I have a Flexible Content field that is pre-populated with rows. I want to prevent the first row from being sortable or a drop target. To do this I need to modify the addSortable function of the model (acf-pro-input.js line 601) to this:

    addSortable: function( self ){
    	// add sortable
    		items: '> .layout:not([data-layout="intro"])', // Modified

    Is there a built-in method for just changing a single function of a Field model/class? I don’t think creating a new model is the right way, or is it?

  • I don’t think that you can modify this.

    Not sure if it can be done, but I would look into removing the .sortable from the specific element on one of the acf JS action hooks.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.