PageSourceSearch

https://aldf.org/wp-content/plugins/ACF-Conditional-Taxonomy-Rules…/input_conditional_taxonomy.js?ver=3.0.0

js aldf.org collected 2026-09-24 08:53:51 UTC 1,400 bytes, 56 lines download raw bytes

1(function($){
2
3	// a few helper functions copied from acf-input.js
4	var parseString = function( val ){
5		return val ? '' + val : '';
6	};
7	var isEqualTo = function( v1, v2 ){
8		return ( parseString(v1).toLowerCase() === parseString(v2).toLowerCase() );
9	};
10	var inArray = function( v1, array ){
11
12		// cast all values as string
13		array = array.map(function(v2){
14			return parseString(v2);
15		});
16
17		return (array.indexOf( v1 ) > -1);
18	}
19
20	// add our new conditional for matching against taxonomy IDs
21	var TaxonomyEqualTo = acf.Condition.extend({
22		type: 'taxonomyEqualTo',
23		operator: '==',
24		label: 'Selection Term ID equals',
25		fieldTypes: [ 'taxonomy' ],
26		match: function( rule, field ){
27			var val = field.val();
28			if ( val instanceof Array ) {
29				return inArray( rule.value, val );
30			} else {
31				return isEqualTo( rule.value, val );
32			}
33		},
34		choices: function( fieldObject ){
35			return '<input type="number" />';
36		}
37	});
38
39	acf.registerConditionType( TaxonomyEqualTo );
40
41	var TaxonomyNotEqualTo = TaxonomyEqualTo.extend({
42		type: 'taxonomyNotEqualTo',
43		operator: '!=',
44		label: "Selection Term ID not equal to",
45		fieldTypes: ['taxonomy'],
46		match: function (rule, field) {
47			return !TaxonomyEqualTo.prototype.match.apply(this, arguments)
48		},
49		choices: function (fieldObject) {
50			return '<input type="number" />';
51		}
52	});
53
54	acf.registerConditionType(TaxonomyNotEqualTo);
55
56})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.