function xmlsitemap_add_form_entity_summary in XML sitemap 6.2
Same name and namespace in other branches
- 8 xmlsitemap.module \xmlsitemap_add_form_entity_summary()
- 7.2 xmlsitemap.admin.inc \xmlsitemap_add_form_entity_summary()
- 2.x xmlsitemap.module \xmlsitemap_add_form_entity_summary()
Add a table summary for an entity and its bundles.
1 call to xmlsitemap_add_form_entity_summary()
- xmlsitemap_settings_form in ./
xmlsitemap.admin.inc - Form builder; Administration settings form.
File
- ./
xmlsitemap.admin.inc, line 502 - Administrative page callbacks for the xmlsitemap module.
Code
function xmlsitemap_add_form_entity_summary(&$form, $entity, array $entity_info) {
$priorities = xmlsitemap_get_priority_options(NULL, FALSE);
$statuses = xmlsitemap_get_status_options(NULL);
$destination = drupal_get_destination();
$rows = array();
$totals = array(
'total' => 0,
'indexed' => 0,
'visible' => 0,
);
foreach ($entity_info['bundles'] as $bundle => $bundle_info) {
// Fetch current per-bundle link total and indexed counts.
$status = xmlsitemap_get_link_type_indexed_status($entity, $bundle);
$totals['total'] += $status['total'];
$totals['indexed'] += $status['indexed'];
$totals['visible'] += $status['visible'];
$row = array();
$edit_link = xmlsitemap_get_operation_link("admin/settings/xmlsitemap/settings/{$entity}/{$bundle}", array(
'modal' => TRUE,
));
if (!empty($edit_link['router info']['access'])) {
$row[] = l($bundle_info['label'], $edit_link['href'], $edit_link);
}
else {
// Bundle labels are assumed to be un-escaped input.
$row[] = check_plain($bundle_info['label']);
}
$row[] = $statuses[$bundle_info['xmlsitemap']['status'] ? 1 : 0];
$row[] = $priorities[number_format($bundle_info['xmlsitemap']['priority'], 1)];
$row[] = $status['total'];
$row[] = $status['indexed'];
$row[] = $status['visible'];
$rows[] = $row;
}
if ($rows) {
$header = array(
isset($entity_info['bundle label']) ? $entity_info['bundle label'] : '',
t('Inclusion'),
t('Priority'),
t('Available'),
t('Indexed'),
t('Visible'),
);
$rows[] = array(
array(
'data' => t('Totals'),
'colspan' => 3,
'header' => TRUE,
),
array(
'data' => $totals['total'],
'header' => TRUE,
),
array(
'data' => $totals['indexed'],
'header' => TRUE,
),
array(
'data' => $totals['visible'],
'header' => TRUE,
),
);
$form['summary'] = array(
'#value' => theme('table', $header, $rows),
);
}
}