gpb_resource_field_resources

  1. Description
  2. Usage
  3. Parameters
  4. Since
  5. Examples
    1. Filter by Resource Type

Description

Filter the resources used to populate an individual Resource field.

Usage

window.gform.addFilter( 'gpb_resource_field_resources', function ( resources, context ) {
	return resources;
} );

Parameters

  • resources array

    Resources available for the selected service.

  • context object

    Context for the Resource field being populated.

  • context.formId number

    The current form ID.

  • context.fieldId number

    The current Resource field ID.

  • context.serviceId number

    The selected service ID.

Since

This filter is available since version 1.0.2.

Examples

Filter by Resource Type

Show only resources from a specific Resource Type.

window.gform.addFilter('gpb_resource_field_resources', function(resources, context) {
	return resources.filter(function(resource) {
		return resource.resourceType === 123;
	});
});