public function FractionItem::isEmpty in Fraction 8
Same name and namespace in other branches
- 2.x src/Plugin/Field/FieldType/FractionItem.php \Drupal\fraction\Plugin\Field\FieldType\FractionItem::isEmpty()
Determines whether the data structure is empty.
Return value
bool TRUE if the data structure is empty, FALSE otherwise.
Overrides NumericItemBase::isEmpty
File
- src/
Plugin/ Field/ FieldType/ FractionItem.php, line 87
Class
- FractionItem
- Plugin implementation of the 'fraction' field type.
Namespace
Drupal\fraction\Plugin\Field\FieldTypeCode
public function isEmpty() {
$numerator = $this
->get('numerator')
->getValue();
$denominator = $this
->get('denominator')
->getValue();
return (string) $numerator !== '0' && empty($numerator) || (string) $denominator !== '0' && empty($denominator);
}