public function BatTypeOptions::isEmpty in Booking and Availability Management Tools for Drupal 8
Determines whether the data structure is empty.
Return value
bool TRUE if the data structure is empty, FALSE otherwise.
Overrides Map::isEmpty
File
- modules/
bat_options/ src/ Plugin/ Field/ FieldType/ BatTypeOptions.php, line 61 - Contains \Drupal\bat_options\Plugin\Field\FieldType\BatTypeOptions.
Class
- BatTypeOptions
- Plugin annotation @FieldType( id = "bat_options", label = @Translation("BAT Type Options"), description = @Translation("BAT Type Options."), default_widget = "bat_options_combined", default_formatter = "bat_options_default" )
Namespace
Drupal\bat_options\Plugin\Field\FieldTypeCode
public function isEmpty() {
return empty($this
->get('name')
->getValue()) || empty($this
->get('quantity')
->getValue()) || !(is_numeric($this
->get('quantity')
->getValue()) && is_int((int) $this
->get('quantity')
->getValue())) || (empty($this
->get('value')
->getValue()) || !is_numeric($this
->get('value')
->getValue())) && $this
->get('operation')
->getValue() != 'no_charge' || empty($this
->get('operation')
->getValue()) || !in_array($this
->get('operation')
->getValue(), array_keys(bat_options_price_options()));
}