You are here

function theme_ldap_servers_server in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_servers/ldap_servers.theme.inc \theme_ldap_servers_server()
  2. 7 ldap_servers/ldap_servers.theme.inc \theme_ldap_servers_server()

Returns HTML for ldap server.

Parameters

$variables: An associative array containing:

  • ldap_server: 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

3 theme calls to theme_ldap_servers_server()
ldap_servers_admin_delete in ldap_servers/ldap_servers.admin.inc
Implements the LDAP server delete page.
ldap_servers_admin_enable_disable in ldap_servers/ldap_servers.admin.inc
Implements the LDAP server delete page.
ldap_servers_test_form in ldap_servers/ldap_servers.test_form.inc
Implements the LDAP server test page.

File

ldap_servers/ldap_servers.theme.inc, line 75
Theming functions for ldap_servers module.

Code

function theme_ldap_servers_server($variables) {

  /** @var array $ldap_server */

  /** @var bool $actions */

  /** @var string $type */
  extract($variables);
  ldap_servers_module_load_include('php', 'ldap_servers', 'LdapServer.class');
  $properties = [];
  foreach (LdapServer::field_to_properties_map() as $field_name => $property_name) {
    $properties[] = "{$field_name} = " . print_r($ldap_server->{$property_name}, TRUE);
  }
  if ($actions) {
    $admin = new LdapServerAdmin($ldap_server->sid);
    $properties = join(' | ', $admin
      ->getLdapServerActions());
  }
  $output = theme_item_list([
    'items' => $properties,
    'type' => 'ul',
    'title' => 'Server Properties',
    'attributes' => [],
  ]);
  return $output;
}