function theme_ldap_servers_list in Lightweight Directory Access Protocol (LDAP) 7.2
Same name and namespace in other branches
- 8.2 ldap_servers/ldap_servers.theme.inc \theme_ldap_servers_list()
- 7 ldap_servers/ldap_servers.theme.inc \theme_ldap_servers_list()
Returns HTML for ldap servers list.
Parameters
$variables: An associative array containing:
- ldap_servers: an array of one or more ldap server configurations.
- actions: true or false indicating include update, delete, etc. links
- type: 'table', 'list', etc for style to render
Return value
string
1 theme call to theme_ldap_servers_list()
- ldap_servers_servers_list in ldap_servers/
ldap_servers.admin.inc - LDAP servers list.
File
- ldap_servers/
ldap_servers.theme.inc, line 21 - Theming functions for ldap_servers module.
Code
function theme_ldap_servers_list($variables) {
/** @var array $ldap_servers */
/** @var bool $actions */
/** @var string $type */
extract($variables);
$table = [
'header' => [
t('Name'),
t('Type'),
t('Enabled'),
t('Server Address'),
],
'attributes' => [
'id' => 'ldap_servers_servers',
'class' => 'data',
],
'colgroups' => [],
'sticky' => FALSE,
'empty' => '',
'caption' => 'LDAP Server Configurations',
];
if ($actions) {
$table['header'][] = "Operations";
}
if (count($ldap_servers)) {
foreach ($ldap_servers as $sid => $ldap_server) {
$row = [
$ldap_server->name,
$ldap_server->ldap_type,
$ldap_server->status == 1 ? "Yes" : "No",
$ldap_server->address,
];
if ($actions) {
$admin = new LdapServerAdmin($ldap_server->sid);
$row[] = join(' | ', $admin
->getLdapServerActions());
}
$table['rows'][] = $row;
}
}
else {
$table['rows'] = [];
}
$output = theme('table', $table);
return $output;
}