>|null */ private ?array $items = null; public function __construct( Context $context, private readonly ImageProvider $imageProvider, array $data = [] ) { parent::__construct($context, $data); } /** * @return array> */ public function getItems(): array { if ($this->items === null) { $this->items = array_values(array_filter( $this->imageProvider->getImagesByCategoryId($this->getCategoryId()), static fn (array $item): bool => trim((string) $item['thumbnail_url']) !== '' )); } return $this->items; } public function getCacheKeyInfo(): array { return [ 'ESUN_HOMEPAGE_INNOVATIVE_MATERIALS', (int) $this->_storeManager->getStore()->getId(), $this->getCategoryId(), ]; } public function getIdentities(): array { $identities = []; $categoryId = $this->getCategoryId(); if ($categoryId > 0) { $identities[] = Category::CACHE_TAG . '_' . $categoryId; } foreach ($this->getItems() as $item) { $identities[] = Image::CACHE_TAG . '_' . (int) $item['id']; } return array_values(array_unique($identities)); } private function getCategoryId(): int { return (int) $this->_scopeConfig->getValue( self::XML_PATH_CATEGORY_ID, ScopeInterface::SCOPE_STORE ); } }