You are here

function views_handler_field_views_system_screenshot::render in Views System 7.4

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides views_handler_field::render

File

views/views_handler_field_views_system_screenshot.inc, line 66
Definition of views_handler_field_views_system_screenshot.

Class

views_handler_field_views_system_screenshot
Field handler to display the thumbnail image of a theme.

Code

function render($values) {
  $value = $values->{$this->field_alias};
  if (!$this->options['image']) {
    return $value;
  }
  if (!empty($value)) {
    $screenshot = array(
      'path' => $value,
      'alt' => t('Screenshot'),
      'title' => t('Screenshot'),
      'width' => $this->options['image_width'],
      'height' => $this->options['image_height'],
      'attributes' => array(
        'class' => array(
          'screenshot',
        ),
      ),
    );
  }
  else {
    $screenshot = array(
      'path' => drupal_get_path('module', 'views_system') . '/images/no_screenshot.png',
      'alt' => t('No screenshot'),
      'title' => t('No screenshot'),
      'width' => $this->options['image_width'],
      'height' => $this->options['image_height'],
      'attributes' => array(
        'class' => array(
          'no-screenshot',
        ),
      ),
    );
  }
  return theme('image', $screenshot);
}