Check that $contenttype['viewless'] is set before comparison and explictly compare to boolean

Fixes #2189