function theme_search_api_server in Search API 7
Returns HTML for displaying a server.
Parameters
array $variables: An associative array containing:
- id: The server's id.
- name: The server's name.
- machine_name: The server's machine name.
- description: The server's description.
- enabled: Boolean indicating whether the server is enabled.
- class_id: The used service class' ID.
- class_name: The used service class' display name.
- class_description: The used service class' description.
- indexes: A list of indexes associated with this server, either as an HTML string or a render array.
- options: An HTML string or render array containing information about the server's service-specific settings.
- status: The entity configuration status (in database, in code, etc.).
- extra: An array of additional server information in the format specified by SearchApiAbstractService::getExtraInformation().
Return value
string HTML for displaying a server.
1 theme call to theme_search_api_server()
- search_api_admin_server_view in ./
search_api.admin.inc - Page callback: Displays information about a server.
File
- ./
search_api.admin.inc, line 437 - Administration page callbacks for the Search API module.
Code
function theme_search_api_server(array $variables) {
$machine_name = $variables['machine_name'];
$description = $variables['description'];
$enabled = $variables['enabled'];
$class_id = $variables['class_id'];
$class_name = $variables['class_name'];
$indexes = $variables['indexes'];
$options = $variables['options'];
$status = $variables['status'];
$extra = $variables['extra'];
// First, output the index description if there is one set.
$output = '';
if ($description) {
$output .= '<p class="description">' . nl2br(check_plain($description)) . '</p>';
}
// Then, display a table summarizing the index's status.
$rows = array();
// Create a row template with references so we don't have to deal with the
// complicated structure for each individual row.
$row = array(
'data' => array(
array(
'header' => TRUE,
),
'',
),
'class' => array(
'',
),
);
$label =& $row['data'][0]['data'];
$info =& $row['data'][1];
$class =& $row['class'][0];
if ($enabled) {
$class = 'ok';
$info = t('enabled (!disable_link)', array(
'!disable_link' => l(t('disable'), 'admin/config/search/search_api/server/' . $machine_name . '/disable'),
));
}
else {
$class = 'warning';
$info = t('disabled (!enable_link)', array(
'!enable_link' => l(t('enable'), 'admin/config/search/search_api/server/' . $machine_name . '/enable', array(
'query' => array(
'token' => drupal_get_token($machine_name),
),
)),
));
}
$label = t('Status');
$rows[] = _search_api_deep_copy($row);
$class = '';
$label = t('Service class');
if (module_exists('help')) {
$url_options['fragment'] = drupal_clean_css_identifier($class_id);
$info = l($class_name, 'admin/help/search_api', $url_options);
}
else {
$info = check_plain($class_name);
}
$rows[] = _search_api_deep_copy($row);
if ($indexes) {
$label = t('Search indexes');
$info = render($indexes);
$rows[] = _search_api_deep_copy($row);
}
if ($options) {
$label = t('Service options');
$info = render($options);
$rows[] = _search_api_deep_copy($row);
}
if ($status != ENTITY_CUSTOM) {
$label = t('Configuration status');
$info = theme('entity_status', array(
'status' => $status,
));
$class = $status == ENTITY_OVERRIDDEN ? 'warning' : 'ok';
$rows[] = _search_api_deep_copy($row);
$class = '';
}
if ($extra) {
foreach ($extra as $information) {
$label = $information['label'];
$info = $information['info'];
$class = !empty($information['status']) ? $information['status'] : '';
$rows[] = _search_api_deep_copy($row);
}
}
$theme['rows'] = $rows;
$theme['attributes']['class'][] = 'search-api-summary';
$theme['attributes']['class'][] = 'search-api-server-summary';
$theme['attributes']['class'][] = 'system-status-report';
$output .= theme('table', $theme);
return $output;
}