public function SearchApiCombinedEntityDataSourceController::getItemUrl in Search API 7
Retrieves a URL at which the item can be viewed on the web.
Parameters
mixed $item: An item of this controller's type.
Return value
array|null Either an array containing the 'path' and 'options' keys used to build the URL of the item, and matching the signature of url(), or NULL if the item has no URL of its own.
Throws
SearchApiDataSourceException If any error state was encountered.
Overrides SearchApiAbstractDataSourceController::getItemUrl
File
- includes/
datasource_multiple.inc, line 135 - Contains SearchApiCombinedEntityDataSourceController.
Class
- SearchApiCombinedEntityDataSourceController
- Provides a datasource for indexing multiple types of entities.
Code
public function getItemUrl($item) {
if ($item->item_type == 'file') {
return array(
'path' => file_create_url($item->file->uri),
'options' => array(
'entity_type' => 'file',
'entity' => $item,
),
);
}
$url = entity_uri($item->item_type, $item->{$item->item_type});
return $url ? $url : NULL;
}