Skip to content
Snippets Groups Projects
Commit 1698fbe9 authored by Andrey Vitushkin's avatar Andrey Vitushkin
Browse files

Issue #3446907: Fix the isEmpty() method

parent 4eaad657
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ final class IpAddressMySqlField extends FieldItemBase {
* {@inheritdoc}
*/
public function isEmpty(): bool {
return match ($this->get('value')->getValue()) {
return match ($this->ip_address) {
NULL, '' => TRUE,
default => FALSE,
};
......@@ -46,8 +46,13 @@ final class IpAddressMySqlField extends FieldItemBase {
*/
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition): array {
$properties = [];
$properties['value'] = DataDefinition::create('any')
->setLabel(t('Value'));
$properties['ip_address'] = DataDefinition::create('integer')
->setLabel(t('IP address'))
->setDescription(t('The IP address stored as the INT data type.'));
$properties['network_mask'] = DataDefinition::create('integer')
->setLabel(t('Network mask'))
->setDescription(t('The network mask stored as the INT data type.'));
return $properties;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment