function pmpapi_push_admin_mapping_callback in Public Media Platform API Integration 7
Hide/show bundle mapping fieldset.
If no bundle is chosen, hide the related fieldset of mapping selects. If a bundle is chosen, display the mapping fieldset (for a entity given type and bundle).
#ajax callback for pmpapi_push_admin_config()
Return value
array The mappings for the chosen bundle
See also
1 string reference to 'pmpapi_push_admin_mapping_callback'
- pmpapi_push_admin_config in pmpapi_push/
pmpapi_push.admin.inc - Form constructor for the PMPAPI push admin form.
File
- pmpapi_push/
pmpapi_push.admin.inc, line 138 - Basic admin forms, validators, and submit handlers for the PMPAPI Push module.
Code
function pmpapi_push_admin_mapping_callback($form, $form_state) {
if (!empty($form_state['triggering_element']['#ajax']['pmpapi_push_entity_type']) && !empty($form_state['triggering_element']['#ajax']['pmpapi_push_bundle_name'])) {
$entity_type = $form_state['triggering_element']['#ajax']['pmpapi_push_entity_type'];
$bundle_name = $form_state['triggering_element']['#ajax']['pmpapi_push_bundle_name'];
if ($form_state['triggering_element']['#value'] == '0') {
$form[$entity_type][$bundle_name . '_settings'][$bundle_name . '_mappings']['#attributes']['class'][] = 'element-invisible';
}
else {
$form[$entity_type][$bundle_name . '_settings'][$bundle_name . '_mappings']['#attributes']['class'] = NULL;
}
return $form[$entity_type][$bundle_name . '_settings'][$bundle_name . '_mappings'];
}
}