I am using the following to remove an Item from the Mass Action menu in the orders screen, I am struggling with making it work for multiple items.
class MassAction extends \Magento\Ui\Component\MassAction
{
private $authorization;
public function __construct(
\Magento\Framework\View\Element\UiComponent\ContextInterface $context,
\Magento\Framework\AuthorizationInterface $authorization,
array $components,
array $data
) {
$this->authorization = $authorization;
parent::__construct($context, $components, $data);
}
public function prepare() {
parent::prepare();
$config = $this->getConfiguration();
$allowedActions = [];
foreach ($config['actions'] as $action) {
if ('cancel' != $action['type']) {
$allowedActions[] = $action;
}
}
$config['actions'] = $allowedActions;
$this->setData('config', (array)$config);
parent::prepare();
$config = $this->getConfiguration();
$allowedActions = [];
foreach ($config['actions'] as $action) {
if ('hold_order' != $action['type']) {
$allowedActions[] = $action;
}
}
$config['actions'] = $allowedActions;
$this->setData('config', (array)$config);
}
}
Can anyone assist?