Support

Account

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

Helping

JavaScript API – Modifying a Field model's function

  • 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
    	this.$layoutsWrap().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. https://www.google.com/search?q=jquery+remove+.sortable

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

You must be logged in to reply to this topic.