public function FractionItem::isEmpty in Fraction 2.x
Same name and namespace in other branches
- 8 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 85
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);
}