ACF Table Field Pro Add-on Docs Last updated:

Filters

Adding a filter

Parameters

ACFTableFieldPro.core.addFilter( scope, filterName, handler, priority );
    • scope
    • (string)
    • The slug of the module

    • filterName
    • (string)
    • The name of the filter.

    • handler
    • (callable)
    • The callback function.

    • priority
    • (optional) (integer)
    • Defaults: 10
    • Used to specify the order in which the functions associated with a particular action are executed. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added.

Add a filter in a module example

jQuery.noConflict();
jQuery( document ).ready( function( $ ) {

	function ACFTableFieldMyModule() {

		var t = this;

		t.init = function() { 
		 
			ACFTableFieldPro.core.addFilter( 'main', 'filtername', t.filterFunction, 20 ); 
		}; 
		 
		t.filterFunction = function( value, param ) { 
		 
			// additional permanent parameters: 
			// param.filter.part = 'main' 
			// param.filter.filter: 'filtername' 
		 
			return value; 
		 
			// If the filter should apply only once 
			return { 
				applyOnce: true, 
				value: value 
			}; 
		}

	};

	ACFTableFieldPro.mymodule = new ACFTableFieldMyModule();

});

Providing a filter

Provide filter

var value = ACFTableFieldPro.core.doFilter( scope, filterName, value, param );

Example of providing a filter in a module…

Provide a filter in a module example

jQuery.noConflict();
jQuery( document ).ready( function( $ ) {

	function ACFTableFieldMyModule() {

		var t = this;

		t.init = function() { 
		 
			var string = '', 
				param = { 
					key: 'value' 
				}; 
		 
			string = ACFTableFieldPro.core.doFilter( 'main', 'filter_string', string, param ); 
		 
		};

	};

	ACFTableFieldPro.mymodule = new ACFTableFieldMyModule();

});

Previous and Next Sources

Parent sources