function ip_login_entity_base_field_info in IP Login 4.x
Implements hook_entity_base_field_info().
File
- ./
ip_login.module, line 19 - Hooks for the IP login module.
Code
function ip_login_entity_base_field_info(EntityTypeInterface $entity_type) {
if ($entity_type
->id() === 'user') {
$fields['ip_login'] = BaseFieldDefinition::create('ipaddress')
->setLabel(t('Login IP Address'))
->setCardinality(1)
->setSettings([
'allow_family' => 10,
'allow_range' => true,
])
->setDisplayOptions('form', [
'type' => 'ipaddress_default',
])
->setDisplayConfigurable('form', TRUE)
->setDisplayOptions('view', [
'region' => 'hidden',
])
->setDisplayConfigurable('view', TRUE);
return $fields;
}
}