updateItemInCollection
The updateItemInCollection hook is called when an item is added or updated in the collection.
Parameters
-
\Isotope\Model\ProductCollectionItem
$itemThe item that is added or updated.
-
array
$setThe set of data that is used to update the item.
-
\Isotope\Model\ProductCollection
$collectionThe collection the item is added or updated in.
Return Values
The return value is the set of data that is used to update the item.
Example
// src/EventListener/Isotope/UpdateItemInCollectionListener.php
namespace App\EventListener\Isotope;
use Isotope\Model\ProductCollection;
use Isotope\Model\ProductCollectionItem;
use Isotope\ServiceAnnotation\IsotopeHook;
/**
* @IsotopeHook("updateItemInCollection")
*/
class UpdateItemInCollectionListener
{
public function __invoke(ProductCollectionItem $item, array $set, ProductCollection $collection): array
{
return $set;
}
}