Field->exists() bug [on field of files]


#1

When I call exists() on a file field, I get a boolean(false) return no matter whether the field exists or not. A cursory look through the kirby source would seen to indicate this is because exists() only works on page and file objects and not on the fields of file objects.

File fields defined as shown here

Kirby 2.5.2


#2

That’s true, I’m afraid. The FieldsAbstract class where this method is defined is only page related.


#3

So this bug will not be fixed?

It seems possible to use field()->length() as a sort-of-the-same substitute.


#4

That’s not what I meant. Haven’t checked if there’s already an issue on GitHub.

You could also use isNotEmpty().

New issue on GitHub:

https://github.com/getkirby/kirby/issues/591