1. Home
  2. Matador Extensions
  3. Syndication XML Feeds
  4. DocCafé Feed: Mapping Taxonomies to Restricted Fields: Position Type, Specialty or Work Environment

DocCafé Feed: Mapping Taxonomies to Restricted Fields: Position Type, Specialty or Work Environment

Contents

DocCafé has some fields where the job data sent must match a value in a predefined list of values for it to be accepted: this helps them keep their data clean and well-categorised, but these predefined values might not match the way you categorise jobs. The DocCafé XML feed can include job data for specialty, position type and work environment. Below you’ll find a code example showibf how to map your job data to the accepted values for the work environment field, this structure can be applied to map any of the position type, specialty or work environment fields using the following filters:

  • matador_extension_feeds_doccafe_specialty
  • matador_extension_feeds_doccafe_work_environment
  • matador_extension_feeds_doccafe_position_type

Example Code

<?php 

add_filter( 'matador_extension_feeds_doccafe_work_environment', 'matador_tutorial_custom_work_environment_mapping', 10, 3);

function matador_tutorial_custom_work_environment_mapping( $default_environment, $job_data, $accepted_environments ) {

    $sanitized_environment = '';

    $work_environment_key = 'field_name'; // Replace this with the job field name you're using to store this value on the job object

    if ( ! empty( $job_data[ $work_environment_key ] ) ) {

        $raw = $job_data[ $work_environment_key ];
        switch ( $raw ) {
            case 'Remote Medicine':
                $mapped = 'TELEMEDICINE';
                break;
            case 'Faculty':
                $mapped = "ACADEMIC/TRAINING PROGRAM";
                break;
            // add more cases here to map all the values you need to
        }

        // sanity check to make sure our mapped value is in the accepted environments list
        if ( in_array( $mapped, $accepted_environments ) ) {
            $sanitized_environment = $mapped;
        }
    }

    return $sanitized_environment;
}
Updated on September 24, 2024
Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support