You are here

public function GoogleCSEServices::siteSearchForm in Google Custom Search Engine 8.3

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

Returns SiteSearch options form item.

File

src/GoogleCSEServices.php, line 481

Class

GoogleCSEServices
Additional functions as services for Google CSE.

Namespace

Drupal\google_cse

Code

public function siteSearchForm(&$form) {
  if ($options = $this
    ->sitesearchOptions()) {
    $form['sitesearch'] = [
      '#type' => $this->CSEconfig
        ->get('sitesearch_form'),
      '#options' => $options,
      '#default_value' => $this
        ->sitesearchDefault(),
    ];
    if ($form['sitesearch']['#type'] == 'select' && isset($form['sa'])) {
      $form['sa']['#weight'] = 10;
    }
  }
}