public function SearchApiSavedSearchesViewsHandlerFieldLink::render in Search API Saved Searches 7
Render the field.
Parameters
array $values: The values retrieved from the database.
Overrides views_handler_field::render
File
- views/
handler_field_saved_search_link.inc, line 39 - Contains the SearchApiSavedSearchesViewsHandlerFieldName class.
Class
- SearchApiSavedSearchesViewsHandlerFieldLink
- Views field handler for displaying a saved search's name, optionally linked to the search page.
Code
public function render($values) {
$search = !empty($values->id) ? search_api_saved_search_load($values->id) : NULL;
if (search_api_saved_search_edit_access(NULL, $search)) {
$url = $url = 'search-api/saved-search/' . $search->id;
switch ($this->real_field) {
case 'edit_link':
$default_label = t('edit');
$url .= '/edit';
break;
case 'delete_link':
$default_label = t('delete');
$url .= '/delete';
break;
default:
return;
}
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = $url;
return $this->options['text'] ? $this->options['text'] : $default_label;
}
}