You are here

public function SearchApiSavedSearchesViewsHandlerFieldInterval::render in Search API Saved Searches 7

Overrides views_handler_field_time_interval::render().

Takes custom labels from the associated settings, if the corresponding handler option is enabled.

Overrides views_handler_field_time_interval::render

File

views/handler_field_saved_search_interval.inc, line 62
Contains the SearchApiSavedSearchesViewsHandlerFieldInterval class.

Class

SearchApiSavedSearchesViewsHandlerFieldInterval
Views field handler for displaying a saved search's notification interval.

Code

public function render($values) {
  if ($this->options['custom_labels']) {
    $field = $this->aliases['settings_id'];
    if ($values->{$field} && ($settings = search_api_saved_searches_settings_load($values->{$field}))) {
      $intervals = $settings
        ->getTranslatedOption('interval_options');
      if (isset($intervals[$values->{$this->field_alias}])) {
        return $intervals[$values->{$this->field_alias}];
      }
    }
  }
  if ($values->{$this->field_alias} < 0) {
    return t('Never');
  }
  return parent::render($values);
}