Quote:
Originally Posted by jesscat
Another question for you: can you test on the ondevice field? If so, what happens if there is no device connected? Or do you first have to check to see if that field exists?
|
Currently the ondevice field cannot be used in templates. There are issues with making it a normal template field.
However, it is clearly useful to be able to use ondevice in color templates, so I have added a new template function, ondevice(), to fetch its value. This function should appear in the next release, earlier if you run from source. The function returns 'Yes' (translated if not running in English) if a device is connected and the book is on that device. It returns the empty string if the book is not on the device or if a device is not connected.
You can use the ondevice function where you would use field('ondevice') if only ondevice were a real field.

You can also use it in template function mode as {:'ondevice()'} (the field name is omitted).