protected function _getItemsData()
{
$items = [];
/** @var \Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection $productCollection */
$productCollection = $this->getLayer()->getProductCollection();
$optionsFacetedData = $productCollection->getFacetedData($this->getFilterField());
$currentCategory = $this->dataProvider->getCategory();
$categories = $this->getChildrenCategories();
if ($currentCategory->getIsActive()) {
foreach ($categories as $category) {
if (isset($optionsFacetedData[(int) $category->getId()])) {
$productCount = $optionsFacetedData[$category->getId()]['count'];
if ($category->getIsActive() && $productCount > 0) {
$item = ['label' => $this->escaper->escapeHtml($category->getName()), 'value' => $category->getId(), 'count' => $optionsFacetedData[$category->getId()]['count'], 'url' => $category->getUrl()];
$items[] = $item;
}
}
}
}
return $items;
}