Skip to content

Instantly share code, notes, and snippets.

@quisse
quisse / OutputPlugin.php
Last active May 10, 2019 14:52
Adding a productAttribute handler in Magento 2
<?php
namespace Vendor\Module\Plugin;
use Magento\Catalog\Helper\Output;
class OutputPlugin {
// this plugin method should be on a method which collects all handlers and isn't called everytime the handlers are processed
public function beforeProcess(Output $outputHelper, $method, $result, $params) {
@quisse
quisse / OutputPlugin.php
Created April 4, 2018 08:43
Proposal for adding a productAttribute handler in Magento 2
<?php
namespace Vendor\Module\Plugin;
use Magento\Catalog\Helper\Output;
class OutputPlugin {
public function beforeCollectHandlers(Output $outputHelper) {
$outputHelper->addHandler('productAttribute', $this);