public static function YamlFormMultiple::isEmpty in YAML Form 8
Check if array is empty.
Parameters
string|array $value: An item.
Return value
bool FALSE if item is an empty string or an empty array.
1 call to YamlFormMultiple::isEmpty()
- YamlFormMultiple::convertValuesToItems in src/
Element/ YamlFormMultiple.php - Convert an array containing of values (elements or _item_ and weight) to an array of items.
File
- src/
Element/ YamlFormMultiple.php, line 492
Class
- YamlFormMultiple
- Provides a form element to assist in creation of multiple elements.
Namespace
Drupal\yamlform\ElementCode
public static function isEmpty($value = NULL) {
if (is_null($value)) {
return TRUE;
}
elseif (is_string($value)) {
return $value === '' ? TRUE : FALSE;
}
elseif (is_array($value)) {
return !array_filter($value, function ($item) {
return !self::isEmpty($item);
});
}
else {
return FALSE;
}
}