When we are injecting some class into another using constructor we are making this:
protected $someClass
public function __construct(SomeClass $someClass)
{
$this->someClass = $someClass;
}
But what if we need to pass some argument into this SomeClass
?
Magento has following implementation:
Magento\Catalog\Model\Layer\FilterList
$this->filters = [
$this->objectManager->create($this->filterTypes[self::CATEGORY_FILTER], ['layer' => $layer]),
];
I wan't to inject my own filter into plugin and pass into it ['layer' => $layer]
Please advice.