upadted to 1.8
This commit is contained in:
@@ -11,14 +11,16 @@ class SearchApiAlterAddViewedEntity extends SearchApiAbstractAlterCallback {
|
||||
* @see SearchApiAlterCallbackInterface::supportsIndex()
|
||||
*/
|
||||
public function supportsIndex(SearchApiIndex $index) {
|
||||
return (bool) entity_get_info($index->item_type);
|
||||
return (bool) $index->getEntityType();
|
||||
}
|
||||
|
||||
public function configurationForm() {
|
||||
$info = entity_get_info($this->index->item_type);
|
||||
$view_modes = array();
|
||||
foreach ($info['view modes'] as $key => $mode) {
|
||||
$view_modes[$key] = $mode['label'];
|
||||
if ($entity_type = $this->index->getEntityType()) {
|
||||
$info = entity_get_info($entity_type);
|
||||
foreach ($info['view modes'] as $key => $mode) {
|
||||
$view_modes[$key] = $mode['label'];
|
||||
}
|
||||
}
|
||||
$this->options += array('mode' => reset($view_modes));
|
||||
if (count($view_modes) > 1) {
|
||||
@@ -60,7 +62,7 @@ class SearchApiAlterAddViewedEntity extends SearchApiAbstractAlterCallback {
|
||||
$original_user = $GLOBALS['user'];
|
||||
$GLOBALS['user'] = drupal_anonymous_user();
|
||||
|
||||
$type = $this->index->item_type;
|
||||
$type = $this->index->getEntityType();
|
||||
$mode = empty($this->options['mode']) ? 'full' : $this->options['mode'];
|
||||
foreach ($items as $id => &$item) {
|
||||
// Since we can't really know what happens in entity_view() and render(),
|
||||
|
||||
Reference in New Issue
Block a user