Skip to content

Instantly share code, notes, and snippets.

@achchu93
Last active November 2, 2022 06:39
Show Gist options
  • Save achchu93/c9e310903806dabca7fc22093c5845b4 to your computer and use it in GitHub Desktop.
Save achchu93/c9e310903806dabca7fc22093c5845b4 to your computer and use it in GitHub Desktop.
function register_related_programs_meta_box() {
$group = new \Fieldmanager_Group(
[
'collapsed' => true,
'name' => 'cps_program_related',
'serialize_data' => false,
'children' => [
'override' => new \Fieldmanager_Checkbox(
[
'label' => __( 'Hide PIM Programs (Optional)', 'cps' ),
'inline_label' => true,
'sanitize' => 'esc_html',
]
),
'categories' => new \Fieldmanager_Group(
__( 'Related Program Categories', 'cps' ),
[
'children' => [
'area_of_study' => new \Fieldmanager_Select(
__( 'Area of studies', 'cps' ),
[
'multiple' => true,
'type_ahead' => true,
'datasource' => new \Fieldmanager_Datasource_Term(
[
'taxonomy' => 'nu_pim_area_of_study',
]
),
]
),
'commitment' => new \Fieldmanager_Select(
__( 'Commitment', 'cps' ),
[
'multiple' => true,
'type_ahead' => true,
'datasource' => new \Fieldmanager_Datasource_Term(
[
'taxonomy' => 'nu_pim_commitment',
]
),
]
),
'entry_terms' => new \Fieldmanager_Select(
__( 'Entry Terms', 'cps' ),
[
'multiple' => true,
'type_ahead' => true,
'datasource' => new \Fieldmanager_Datasource_Term(
[
'taxonomy' => 'nu_pim_entry_terms',
]
),
]
),
'location' => new \Fieldmanager_Select(
__( 'Locations', 'cps' ),
[
'multiple' => true,
'type_ahead' => true,
'datasource' => new \Fieldmanager_Datasource_Term(
[
'taxonomy' => 'nu_pim_location',
]
),
]
),
'degree_type' => new \Fieldmanager_Select(
__( 'Program Level', 'cps' ),
[
'multiple' => true,
'type_ahead' => true,
'datasource' => new \Fieldmanager_Datasource_Term(
[
'taxonomy' => 'nu_pim_degree_type',
]
),
]
),
'study_options' => new \Fieldmanager_Select(
__( 'Study Options', 'cps' ),
[
'multiple' => true,
'type_ahead' => true,
'datasource' => new \Fieldmanager_Datasource_Term(
[
'taxonomy' => 'nu_pim_study_options',
]
),
]
),
'visa_eligible' => new \Fieldmanager_Select(
__( 'Visa Eligible', 'cps' ),
[
'multiple' => true,
'type_ahead' => true,
'datasource' => new \Fieldmanager_Datasource_Term(
[
'taxonomy' => 'nu_pim_visa_eligible',
]
),
]
),
],
]
),
'ids' => new \Fieldmanager_Group(
__( 'Related Program', 'cps' ),
[
'add_more_label' => __( 'Add Related Program', 'cps' ),
'sortable' => true,
'extra_elements' => 0,
'limit' => 0,
'children' => [
'id' => new \Fieldmanager_Autocomplete(
[
'show_edit_link' => false,
'label' => __( 'Type to search for a program:', 'cps' ),
'datasource' => new \Fieldmanager_Datasource_Post(
array(
'query_args' => array(
'post_type' => 'cps-program',
),
'use_ajax' => true,
)
),
]
),
],
]
),
],
]
);
$group->add_meta_box( __( 'Related Programs', 'cps' ), 'cps-program' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment