diff --git a/includes/content.menu.inc b/includes/content.menu.inc
index c14c368..ba32cb5 100644
--- a/includes/content.menu.inc
+++ b/includes/content.menu.inc
@@ -27,6 +27,9 @@ function ctools_content_autocomplete_entity($type, $string = '') {
if ($string != '') {
global $user;
$entity_info = entity_get_info($type);
+ if ($type == 'node') {
+ $entity_info['entity keys']['bundle field'] = 'type';
+ }
// We must query all ids, because if every one of the 10 don't have access
// the user may never be able to autocomplete a node title.
@@ -56,6 +59,7 @@ function ctools_content_autocomplete_entity($type, $string = '') {
}
else {
$matches[$result['label'] . " [id: $entity_id]"] = '' . check_plain($result['label']) . '';
+ $matches[$result['label'] . " [id: $entity_id]"] .= isset($result['bundle field']) ? ' (' . check_plain($result['bundle field']) . ')' : '';
}
}
@@ -83,6 +87,11 @@ function _ctools_buildQuery($entity_type, $entity_info, $match = NULL, $match_op
$query->fields($base_table, array($entity_info['entity keys']['label']));
}
+ // Add bundle field to the query, if it exists.
+ if (isset($entity_info['entity keys']['bundle field'])) {
+ $query->fields($base_table, array($entity_info['entity keys']['bundle field']));
+ }
+
// Add a generic entity access tag to the query.
$query->addTag('ctools');
@@ -131,6 +140,7 @@ function _ctools_getReferencableEntities($entity_type, $entity_info, $match = NU
foreach ($results as $record) {
$options[$record->{$entity_info['entity keys']['id']}] = array(
'label' => isset($entity_info['entity keys']['label']) ? check_plain($record->{$entity_info['entity keys']['label']}) : $record->{$entity_info['entity keys']['id']},
+ 'bundle field' => isset($entity_info['entity keys']['bundle field']) ? check_plain($record->{$entity_info['entity keys']['bundle field']}) : '',
);
}
}