Skip to content

Instantly share code, notes, and snippets.

@magevision
Created February 20, 2019 10:05
Show Gist options
  • Save magevision/8552b3843f45f919dcda95860dc89494 to your computer and use it in GitHub Desktop.
Save magevision/8552b3843f45f919dcda95860dc89494 to your computer and use it in GitHub Desktop.
AddCustomCategoryDisplayMode
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Catalog\Model\Category\Attribute\Source\Mode">
<plugin name="magevision_blog38_category_attribute_source_mode" type="MageVision\Blog38\Plugin\Catalog\Model\Category\Attribute\Source\Mode"/>
</type>
</config>
<?php
namespace MageVision\Blog38\Plugin\Catalog\Model\Category\Attribute\Source;
class Mode
{
/**
* @param \Magento\Catalog\Model\Category\Attribute\Source\Mode $subject
* @param $result
* @return array
*/
public function afterGetAllOptions(
\Magento\Catalog\Model\Category\Attribute\Source\Mode $subject,
$result
) {
$result[] = ['value' => 'CUSTOM_MODE', 'label' => 'Custom Mode'];
return $result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment