get('contact_channels', []); $ids = empty($params['ids']) ? [] : json_decode($params['ids']); if ($ids && is_array($ids)) { $subscribedChannels = $params['subscribed_channels'] ?? []; $preferredChannel = $params['preferred_channel'] ?? null; $this->channelActionModel->update($ids, $subscribedChannels); $this->frequencyActionModel->update($ids, $params, $preferredChannel); $this->addFlashMessage('mautic.lead.batch_leads_affected', [ '%count%' => count($ids), ]); } else { $this->addFlashMessage('mautic.core.error.ids.missing'); } return new JsonResponse([ 'closeModal' => true, 'flashes' => $this->getFlashContent(), ]); } /** * View for batch action. */ public function indexAction(): \Symfony\Component\HttpFoundation\Response { $route = $this->generateUrl('mautic_channel_batch_contact_set'); return $this->delegateView([ 'viewParameters' => [ 'form' => $this->createForm(ContactChannelsType::class, [], [ 'action' => $route, 'channels' => $this->contactModel->getPreferenceChannels(), 'public_view' => false, 'save_button' => true, ])->createView(), ], 'contentTemplate' => '@MauticLead/Batch/channel.html.twig', 'passthroughVars' => [ 'activeLink' => '#mautic_contact_index', 'mauticContent' => 'leadBatch', 'route' => $route, ], ]); } }