Skip to content

Instantly share code, notes, and snippets.

@magevision
Created January 8, 2019 14:47
Show Gist options
  • Save magevision/1e81608ac94578ca76624a8da7c9ef9b to your computer and use it in GitHub Desktop.
Save magevision/1e81608ac94578ca76624a8da7c9ef9b to your computer and use it in GitHub Desktop.
UpdateLayoutOnAttributeSet
<?php
namespace MageVision\Blog37\Plugin\Catalog\Helper\Product;
use Magento\Catalog\Model\Product;
use Magento\Framework\View\Result\Page as ResultPage;
class View
{
public function beforeInitProductLayout(
\Magento\Catalog\Helper\Product\View $subject,
ResultPage $resultPage,
Product $product,
$params = null
) {
$resultPage->addPageLayoutHandles(
['attribute_set_id' => $product->getAttributeSetId()]
);
return [$resultPage, $product, $params];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment