I wonder whether it would make sense for isset() to take empty arrays into account?
If I correctly understand the application, it is used to check if a widget field is undefined, null or ''.
However, unpopulated media-input-fields with a "multiple" parameter set to true, can return an empty array, right?
(At least I get an empty array, when I delete all existing videos from a 'video-input' field.)
Of course, a user could simply implement something like the following:
// Uses the input of a media field to test whether media was added to it.
function isMediaFieldPopulated(input) {
return (input && (Array.isArray(input) ? (input.length > 0) : true));
}
I wonder whether it would make sense for
isset()to take empty arrays into account?If I correctly understand the application, it is used to check if a widget field is
undefined,nullor''.However, unpopulated media-input-fields with a "multiple" parameter set to
true, can return an empty array, right?(At least I get an empty array, when I delete all existing videos from a 'video-input' field.)
Of course, a user could simply implement something like the following: