You are here

protected function GoogleCSEServices::thumbnail in Google Custom Search Engine 8.3

Same name and namespace in other branches
  1. 8.2 src/GoogleCSEServices.php \Drupal\google_cse\GoogleCSEServices::thumbnail()

Returns the thumbnail properly themed if configured to do so.

Parameters

string $title: Image Title.

array $image_att: Image array.

Return value

string||empty The HTML for the image.

1 call to GoogleCSEServices::thumbnail()
GoogleCSEServices::responseResults in src/GoogleCSEServices.php
Function to fetch the results xml from Google.

File

src/GoogleCSEServices.php, line 254

Class

GoogleCSEServices
Additional functions as services for Google CSE.

Namespace

Drupal\google_cse

Code

protected function thumbnail($title, array $image_att) {
  if ($this->CSEconfig
    ->get('configuration')['results_display_images']) {
    $image = [
      'type' => 'image',
      'path' => isset($image_att['value']) ? $image_att['value'] : '',
      'alt' => $title,
      'title' => $title,
      'attributes' => [
        'width' => '100px',
      ],
      'getsize' => FALSE,
    ];
    return $this->renderer
      ->render($image);
  }
  return '';
}