function microdata_mapping_overview in Microdata 7
Callback function for viewing all bundles' RDF mappings.
1 string reference to 'microdata_mapping_overview'
- microdata_menu in ./
microdata.module - Implements hook_menu().
File
- ./
microdata.admin.inc, line 308 - Microdata administration and module settings UI.
Code
function microdata_mapping_overview() {
// Include the CTools tools that we need.
ctools_include('ajax');
ctools_include('modal');
// Add CTools' javascript to the page.
ctools_modal_add_js();
$render = array();
$entities = entity_get_info();
$fields = field_info_instances();
$render['tabs'] = array(
'#type' => 'vertical_tabs',
);
// Create a tab for each entity.
foreach ($entities as $entity_type => $entity) {
$render['tabs'][$entity_type] = array(
'#type' => 'fieldset',
'#title' => check_plain($entity['label']),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
foreach ($entity['bundles'] as $bundle_name => $bundle) {
$rows = array();
$field_mappings = array();
$itemtype = array();
$bundle_fields = $fields[$entity_type][$bundle_name];
$microdata_mapping = microdata_get_mapping($entity_type, $bundle_name);
// Set itemtype.
if (isset($microdata_mapping['#itemtype'])) {
$itemtype = $microdata_mapping['#itemtype'];
}
foreach ($bundle_fields as $field_name => $field) {
$field_mappings[$field_name]['microdata_mapping'] = isset($microdata_mapping[$field_name]) ? $microdata_mapping[$field_name] : '';
$field_mappings[$field_name]['label'] = $fields[$entity_type][$bundle_name][$field_name]['label'];
}
// Theme this bundle's table and add it to it's parent entity's tab.
$variables = array(
'entity_type' => $entity_type,
'bundle_type' => $bundle_name,
'bundle' => $bundle,
'itemtype' => $itemtype,
'field_mappings' => $field_mappings,
);
$render['tabs'][$entity_type][$bundle_name][] = theme('microdata_mapping_admin', $variables);
$render['tabs'][$entity_type][$bundle_name]['edit'] = array(
'#type' => 'markup',
'#markup' => ctools_modal_text_button(t('edit'), "admin/config/services/microdata/mappings/manage/{$entity_type}/{$bundle_name}/nojs", t('Login via modal')),
);
}
}
return $render;
}