I am trying to get the entries in my custom plugin template ( CP )
Each entry has a lightswitch I want to fetch only those where lightswitch is enabled.
In controller file:
$criteria = craft()->elements->getCriteria(ElementType::Entry);
$criteria->section('articles');
$criteria->relatedTo(array(
'field' => 'lightswitchFieldHandle'
));
$criteria->limit = 20;
$products['entries'] = $criteria->find();
$this->renderTemplate('sponsoredentries/_index', $products);
But I am getting 20 entries (as per limit but not as per field)