You are here

public static function AutoUsernameSettingsForm::autoUsernameGetSchemaNameMaxlength in Automatic User Names 8

Fetch the maximum length of the {users}.name field from the schema.

Return value

array An integer of the maximum username length allowed by the database.

2 calls to AutoUsernameSettingsForm::autoUsernameGetSchemaNameMaxlength()
AutoUsernameSettingsForm::autoUsernameCleanstring in src/Form/AutoUsernameSettingsForm.php
Clean up a string segment to be used in a username.
AutoUsernameSettingsForm::buildForm in src/Form/AutoUsernameSettingsForm.php
Form constructor.

File

src/Form/AutoUsernameSettingsForm.php, line 308

Class

AutoUsernameSettingsForm
Class AutoUsernameSettingsForm.

Namespace

Drupal\auto_username\Form

Code

public static function autoUsernameGetSchemaNameMaxlength() {
  $maxlength =& drupal_static(__FUNCTION__);
  if (!isset($maxlength)) {
    $schema = drupal_get_module_schema('user');
    $maxlength = $schema['users_data']['fields']['name']['length'];
  }
  return $maxlength;
}