public function SearchApiFederatedSolrSiteName::configurationForm in Search API Federated Solr 7
Same name and namespace in other branches
- 7.3 src/SearchApiFederatedSolrSiteName.php \SearchApiFederatedSolrSiteName::configurationForm()
- 7.2 src/SearchApiFederatedSolrSiteName.php \SearchApiFederatedSolrSiteName::configurationForm()
Implements SearchApiAlterCallbackInterface::configurationForm().
Overrides SearchApiAbstractAlterCallback::configurationForm
File
- src/
SearchApiFederatedSolrSiteName.php, line 77
Class
- SearchApiFederatedSolrSiteName
- Class SearchApiFederatedSolrSiteName Provides a Search API index data alteration that adds a "Site Name" property to each indexed item.
Code
public function configurationForm() {
if ($this
->useDomainAccess()) {
$form['domain'] = [
'#type' => 'container',
];
// Provide a configuration field to map each Domain to a different label for indexing.
foreach (domain_list_by_machine_name() as $machine_name => $domain) {
$form['domain'][$machine_name] = [
'#type' => 'textfield',
'#title' => t('%domain Domain Label', [
'%domain' => $domain['sitename'],
]),
'#description' => t('Map the Domain to a custom label for search.'),
'#default_value' => !empty($this->options['domain'][$machine_name]) ? $this->options['domain'][$machine_name] : $domain['sitename'],
'#required' => TRUE,
];
}
}
else {
$form['site_name'] = [
'#type' => 'textfield',
'#title' => t('Site Name'),
'#description' => t('The name of the site from which this content originated. This can be useful if indexing multiple sites with a single search index.'),
'#default_value' => !empty($this->options['site_name']) ? $this->options['site_name'] : variable_get('site_name'),
'#required' => TRUE,
];
}
return $form;
}