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

Issue #3455961: The error occurs when a user open the field settings of the...

Issue #3455961: The error occurs when a user open the field settings of the field of the "ipaddress_mysql" field type
parent 77812d00
No related branches found
No related tags found
No related merge requests found
...@@ -42,11 +42,19 @@ final class IpAddressMySqlWidget extends WidgetBase { ...@@ -42,11 +42,19 @@ final class IpAddressMySqlWidget extends WidgetBase {
]; ];
if ($this->getFieldSetting('default_gateway_enabled')) { if ($this->getFieldSetting('default_gateway_enabled')) {
$defaultGateway = inet_ntop($items[$delta]->default_gateway); // We need this check to prevent the error that occurs when a user open
// the field settings on the "Manage fields" page.
if ($items[$delta]->default_gateway) {
$defaultGateway = inet_ntop($items[$delta]->default_gateway);
}
else {
$defaultGateway = '';
}
$element['gateway_value'] = [ $element['gateway_value'] = [
'#type' => 'textfield', '#type' => 'textfield',
'#title' => $this->t('Default Gateway'), '#title' => $this->t('Default Gateway'),
'#default_value' => $defaultGateway ?? '', '#default_value' => $defaultGateway,
]; ];
} }
......
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