function microdata_bundle_type_mapping_form_submit in Microdata 7
Submit callback; saves the bundle-type specific mapping properties.
3 string references to 'microdata_bundle_type_mapping_form_submit'
- microdata_bundle_mapping_form in ./
microdata.admin.inc - Form builder helper function.
- microdata_form_node_type_form_alter in includes/
microdata.form_alter.inc - Implements hook_form_FORM_ID_alter().
- microdata_form_taxonomy_form_vocabulary_alter in includes/
microdata.form_alter.inc - Implements hook_form_FORMID_alter().
File
- includes/
microdata.form_alter.inc, line 202 - Provides inline structured data using Microdata format.
Code
function microdata_bundle_type_mapping_form_submit($form, &$form_state) {
$values = $form_state['values']['microdata'];
unset($values['fields']);
foreach ($values as $entity_type => $fieldset) {
$bundle_type = $fieldset['bundle_type'];
// @todo Remove this type based checking.
if (empty($bundle_type)) {
switch ($entity_type) {
case 'node':
$bundle_type = $form_state['values']['type'];
break;
case 'taxonomy_vocabulary':
$bundle_type = 'taxonomy_vocabulary';
break;
case 'taxonomy_term':
$bundle_type = $form_state['values']['machine_name'];
break;
}
}
$mapping = _microdata_load_mapping($entity_type, $bundle_type);
$mapping['#itemtype'] = drupal_explode_tags($fieldset['itemtype']);
$mapping['title']['#itemprop'] = drupal_explode_tags($fieldset['title_itemprop']);
if ($fieldset['is_item'] == TRUE) {
$mapping['#is_item'] = TRUE;
$mapping['#itemid_token'] = $fieldset['itemid_settings']['itemid_token'];
$mapping['#use_schema_url'] = $fieldset['itemid_settings']['use_schema_url'];
}
else {
$mapping['#is_item'] = FALSE;
}
if ($entity_type == 'taxonomy_term') {
$mapping['description']['#itemprop'] = $fieldset['description_itemprop'];
$mapping['url']['#itemprop'] = $fieldset['url_itemprop'];
}
microdata_save_mapping($entity_type, $bundle_type, $mapping);
}
}