Wpjm_Helpers::list_wpjm_job_types( string $label = null, string $option_code = 'WPJMJOBTYPE', array $args = array() )


Parameters Parameters

$label

(string) (Optional)

Default value: null

$option_code

(string) (Optional)

Default value: 'WPJMJOBTYPE'

$args

(array) (Optional)

Default value: array()


Top ↑

Return Return

(mixed)


Source Source

File: src/integrations/wp-job-manager/helpers/wpjm-helpers.php

	public function list_wpjm_job_types( $label = null, $option_code = 'WPJMJOBTYPE', $args = array() ) {
		if ( ! $this->load_options ) {


			return Automator()->helpers->recipe->build_default_options_array( $label, $option_code );
		}


		if ( ! $label ) {
			$label = esc_attr__( 'Job type', 'uncanny-automator' );
		}

		$token        = key_exists( 'token', $args ) ? $args['token'] : false;
		$is_ajax      = key_exists( 'is_ajax', $args ) ? $args['is_ajax'] : false;
		$target_field = key_exists( 'target_field', $args ) ? $args['target_field'] : '';
		$end_point    = key_exists( 'endpoint', $args ) ? $args['endpoint'] : '';
		$options      = array();

		$options['-1'] = __( 'Any type', 'uncanny-automator' );

		if ( Automator()->helpers->recipe->load_helpers ) {
			// WP Job Manager is hidding terms on non job template
			$terms = get_terms( 'job_listing_type', [ 'hide_empty' => false, 'public' => false ] );
			if ( ! is_wp_error( $terms ) ) {
				if ( ! empty( $terms ) ) {
					foreach ( $terms as $term ) {
						$options[ $term->term_id ] = esc_html( $term->name );
					}
				}
			}
		}
		$type = 'select';

		$option = [
			'option_code'     => $option_code,
			'label'           => $label,
			'input_type'      => $type,
			'required'        => true,
			'supports_tokens' => $token,
			'is_ajax'         => $is_ajax,
			'fill_values_in'  => $target_field,
			'endpoint'        => $end_point,
			'options'         => $options,
		];

		return apply_filters( 'uap_option_list_wpjm_job_types', $option );
	}