public function DoubleField::isEmpty in Double Field 8.3
Same name and namespace in other branches
- 4.x src/Plugin/Field/FieldType/DoubleField.php \Drupal\double_field\Plugin\Field\FieldType\DoubleField::isEmpty()
Determines whether the data structure is empty.
Return value
bool TRUE if the data structure is empty, FALSE otherwise.
Overrides Map::isEmpty
File
- src/
Plugin/ Field/ FieldType/ DoubleField.php, line 450
Class
- DoubleField
- Plugin implementation of the 'double_field' field type.
Namespace
Drupal\double_field\Plugin\Field\FieldTypeCode
public function isEmpty() {
$settings = $this
->getSettings();
foreach ([
'first',
'second',
] as $subfield) {
if ($settings['storage'][$subfield]['type'] == 'boolean') {
// Booleans can be 1 or 0.
if ($this->{$subfield} == 1) {
return FALSE;
}
}
elseif ($this->{$subfield} !== NULL && $this->{$subfield} !== '') {
return FALSE;
}
}
return TRUE;
}