How do you query entries by field values?
You can do the same like with the section, if the query param exists in the field layout 

$widgets = Entry::find()-&gt;widgetColor('blue')-&gt;text(':notempty:')-&gt;anotherField(':empty:')-&gt;section('widget')-&gt;all();


Will search for entries where widgetColor is blue, text is not empty/null and anotherField is empty/null 

Edit: just for people who like to understand the behavior

Just to explain you the where parameter in the ElementQuery. The where function uses the Yii2 Query function directly and works directly at the database layer. When you take a look at your content table you'll see all custom fields have a certain prefix (if you didn't change it) so your widgetColor column will look like field_widgetColor when you do

where-&gt;(['widgetColor' =&gt; 'blue');


it will query

where `content`.`widgetColor` = `blue`


which will throw an error since the column name is field_widgetColor. The __set function in the Yii/component/ QueryBuilder class will set magic property that exists because of the field handle in your field layout... Or to keep it simple: you can access any "magic" property with the same name like an existing field handle. 

Doing 

-&gt;widgetColor($property)


will call the __set function that calls a wrapper that will wrap/attach the field content prefix (field_) to the where function. Thus you can use

where-&gt;(['field_widgetColor' =&gt; 'blue');


or

where-&gt;([Craft::$app-&gt;getFields()-&gt;oldFieldColumnPrefix . 'widgetColor' =&gt; 'blue');