Commit c830cbd4 authored by Dave Reid's avatar Dave Reid

by Dave Reid: Updated for 'object keys' renamed to 'entity keys'.

parent d9e2608b
......@@ -393,7 +393,7 @@ function xmlsitemap_rebuild_form() {
// If the entity is missing a rebuild callback, skip.
continue;
}
if (!empty($info['object keys']['bundle']) && !xmlsitemap_get_link_type_enabled_bundles($entity)) {
if (!empty($info['entity keys']['bundle']) && !xmlsitemap_get_link_type_enabled_bundles($entity)) {
// If the entity has bundles, but no enabled bundles, skip since
// rebuilding wouldn't get any links.
continue;
......
......@@ -24,7 +24,7 @@ function hook_xmlsitemap_link_info() {
'mymodule' => array(
'label' => 'My module',
'base table' => 'mymodule',
'object keys' => array(
'entity keys' => array(
// Primary ID key on {base table}
'id' => 'myid',
// Subtype key on {base table}
......
......@@ -65,7 +65,7 @@ function drush_xmlsitemap_rebuild() {
// If the entity is missing a rebuild callback, skip.
continue;
}
if (!empty($info['object keys']['bundle']) && !xmlsitemap_get_link_type_enabled_bundles($entity)) {
if (!empty($info['entity keys']['bundle']) && !xmlsitemap_get_link_type_enabled_bundles($entity)) {
// If the entity has bundles, but no enabled bundles, skip since
// rebuilding wouldn't get any links.
continue;
......
......@@ -448,11 +448,11 @@ function xmlsitemap_rebuild_batch_fetch($entity, &$context) {
$info = $context['sandbox']['info'];
$query = db_select($info['base table']);
$query->addField($info['base table'], $info['object keys']['id']);
$query->condition($info['object keys']['id'], $context['sandbox']['last_id'], '>');
if (!empty($info['object keys']['bundle'])) {
$query->addField($info['base table'], $info['entity keys']['id']);
$query->condition($info['entity keys']['id'], $context['sandbox']['last_id'], '>');
if (!empty($info['entity keys']['bundle'])) {
$bundles = xmlsitemap_get_link_type_enabled_bundles($entity);
$query->condition($info['object keys']['bundle'], $bundles);
$query->condition($info['entity keys']['bundle'], $bundles);
}
$query->addTag('xmlsitemap_rebuild');
$query->addMetaData('entity', $entity);
......@@ -467,7 +467,7 @@ function xmlsitemap_rebuild_batch_fetch($entity, &$context) {
}
// PostgreSQL cannot have the ORDERED BY in the count query.
$query->orderBy($info['object keys']['id']);
$query->orderBy($info['entity keys']['id']);
$query->range(0, variable_get('xmlsitemap_batch_limit', 100));
......
......@@ -821,7 +821,7 @@ function xmlsitemap_get_link_info($type = NULL, $reset = FALSE) {
'bundles' => array(),
'xmlsitemap' => array(),
);
if (!isset($info['xmlsitemap']['rebuild callback']) && !empty($info['base table']) && !empty($info['object keys']['id']) && !empty($info['xmlsitemap']['process callback'])) {
if (!isset($info['xmlsitemap']['rebuild callback']) && !empty($info['base table']) && !empty($info['entity keys']['id']) && !empty($info['xmlsitemap']['process callback'])) {
$info['xmlsitemap']['rebuild callback'] = 'xmlsitemap_rebuild_batch_fetch';
}
foreach ($info['bundles'] as $bundle => &$bundle_info) {
......@@ -954,10 +954,10 @@ function xmlsitemap_get_link_type_indexed_status($entity_type, $bundle = '') {
$status['visible'] = $visible->countQuery()->execute()->fetchField();
$total = db_select($info['base table']);
$total->addField('xmlsitemap', $info['object keys']['id']);
$total->condition($info['object keys']['id'], 0, '>');
if (!empty($info['object keys']['bundle'])) {
$total->condition($info['object keys']['bundle'], $bundle);
$total->addField('xmlsitemap', $info['entity keys']['id']);
$total->condition($info['entity keys']['id'], 0, '>');
if (!empty($info['entity keys']['bundle'])) {
$total->condition($info['entity keys']['bundle'], $bundle);
}
$status['total'] = $total->countQuery()->execute()->fetchField();
......
......@@ -9,7 +9,7 @@ function xmlsitemap_menu_xmlsitemap_link_info() {
'label' => t('Menu'),
'bundle label' => t('Menu'),
'base table' => 'menu_links',
'object keys' => array(
'entity keys' => array(
'id' => 'mlid',
'bundle' => 'menu_name',
),
......
......@@ -16,7 +16,7 @@ function xmlsitemap_taxonomy_entity_info_alter(&$entity_info) {
*/
function xmlsitemap_taxonomy_xmlsitemap_link_info_alter(&$link_info) {
// Change taxonomy term bundle type from machine name to vid.
$link_info['taxonomy_term']['object keys']['bundle'] = 'vid';
$link_info['taxonomy_term']['entity keys']['bundle'] = 'vid';
foreach (taxonomy_vocabulary_get_names() as $machine_name => $vocabulary) {
// Adjust the edit path to the *real* edit path.
$link_info['taxonomy_term']['bundles'][$machine_name]['admin']['path'] .= '/edit';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment