From ea9f8d553d075d7653e1f0ab83c23c2942965bb0 Mon Sep 17 00:00:00 2001 From: Volha Pivavarchyk Date: Tue, 7 Mar 2023 00:08:25 +0300 Subject: [PATCH 1/9] Convert PHP templates to Twig --- Controller/CustomField/FormController.php | 2 +- Controller/CustomField/SaveController.php | 4 +- Controller/CustomItem/FormController.php | 2 +- Controller/CustomItem/LinkFormController.php | 8 +- Controller/CustomItem/ListController.php | 2 +- Controller/CustomItem/SaveController.php | 2 +- Controller/CustomItem/ViewController.php | 2 +- Controller/CustomObject/FormController.php | 2 +- Controller/CustomObject/ListController.php | 2 +- Controller/CustomObject/SaveController.php | 2 +- Controller/CustomObject/ViewController.php | 2 +- Controller/JsonController.php | 2 +- EventListener/ContactSubscriber.php | 2 +- EventListener/ContactTabSubscriber.php | 10 +- EventListener/CustomItemTabSubscriber.php | 10 +- .../EventListener/ContactSubscriberTest.php | 4 +- .../ContactTabSubscriberTest.php | 14 +- .../CustomItemTabSubscriberTest.php | 20 +-- .../_detail_left_section.html.twig | 25 +++ .../_detail_right_section.html.twig | 23 +++ Views/CustomField/detail.html.php | 56 ------- Views/CustomField/detail.html.twig | 19 +++ Views/CustomField/form.html.php | 105 ------------ Views/CustomField/form.html.twig | 97 ++++++++++++ Views/CustomField/index.html.php | 21 --- Views/CustomField/value.html.php | 23 --- Views/CustomField/value.html.twig | 14 ++ .../CustomItem/_detail_left_section.html.twig | 112 +++++++++++++ .../_detail_right_section.html.twig | 6 + Views/CustomItem/_list.html.twig | 97 ++++++++++++ Views/CustomItem/detail.html.php | 125 --------------- Views/CustomItem/detail.html.twig | 27 ++++ Views/CustomItem/form.html.php | 71 --------- Views/CustomItem/form.html.twig | 55 +++++++ Views/CustomItem/index.html.php | 27 ---- Views/CustomItem/list.html.php | 124 --------------- Views/CustomItem/list.html.twig | 37 +++++ Views/CustomObject/Form/Panel/_field.html.php | 52 ------ .../CustomObject/Form/Panel/_field.html.twig | 47 ++++++ .../Form/Panel/checkbox_group.html.php | 5 - .../Form/Panel/checkbox_group.html.twig | 1 + .../CustomObject/Form/Panel/country.html.php | 5 - .../CustomObject/Form/Panel/country.html.twig | 1 + Views/CustomObject/Form/Panel/date.html.php | 5 - Views/CustomObject/Form/Panel/date.html.twig | 1 + .../CustomObject/Form/Panel/datetime.html.php | 5 - .../Form/Panel/datetime.html.twig | 1 + Views/CustomObject/Form/Panel/email.html.php | 5 - Views/CustomObject/Form/Panel/email.html.twig | 1 + Views/CustomObject/Form/Panel/hidden.html.php | 5 - .../CustomObject/Form/Panel/hidden.html.twig | 1 + .../Form/Panel/html_area.html.php | 5 - .../Form/Panel/html_area.html.twig | 1 + Views/CustomObject/Form/Panel/int.html.php | 5 - Views/CustomObject/Form/Panel/int.html.twig | 1 + .../Form/Panel/multiselect.html.php | 5 - .../Form/Panel/multiselect.html.twig | 1 + Views/CustomObject/Form/Panel/phone.html.php | 5 - Views/CustomObject/Form/Panel/phone.html.twig | 1 + .../Form/Panel/radio_group.html.php | 5 - .../Form/Panel/radio_group.html.twig | 1 + Views/CustomObject/Form/Panel/select.html.php | 5 - .../CustomObject/Form/Panel/select.html.twig | 1 + Views/CustomObject/Form/Panel/text.html.php | 5 - Views/CustomObject/Form/Panel/text.html.twig | 1 + .../CustomObject/Form/Panel/textarea.html.php | 5 - .../Form/Panel/textarea.html.twig | 1 + Views/CustomObject/Form/Panel/url.html.php | 5 - Views/CustomObject/Form/Panel/url.html.twig | 1 + .../_detail_left_section.html.twig | 110 +++++++++++++ .../_detail_right_section.html.twig | 6 + Views/CustomObject/_form-fields.html.php | 24 --- Views/CustomObject/_form-fields.html.twig | 19 +++ Views/CustomObject/_list.html.twig | 74 +++++++++ Views/CustomObject/detail.html.php | 149 ------------------ Views/CustomObject/detail.html.twig | 27 ++++ Views/CustomObject/form.html.php | 125 --------------- Views/CustomObject/form.html.twig | 98 ++++++++++++ Views/CustomObject/index.html.php | 21 --- Views/CustomObject/list.html.php | 94 ----------- Views/CustomObject/list.html.twig | 27 ++++ ...gn_condition_field_value_widget.html.twig} | 0 Views/SubscribedEvents/Tab/content.html.php | 50 ------ Views/SubscribedEvents/Tab/content.html.twig | 47 ++++++ Views/SubscribedEvents/Tab/link.html.php | 15 -- Views/SubscribedEvents/Tab/link.html.twig | 11 ++ Views/SubscribedEvents/Tab/modal.html.php | 8 - Views/SubscribedEvents/Tab/modal.html.twig | 6 + Views/SubscribedEvents/Timeline/link.html.php | 17 -- .../SubscribedEvents/Timeline/link.html.twig | 12 ++ 90 files changed, 1057 insertions(+), 1228 deletions(-) create mode 100644 Views/CustomField/_detail_left_section.html.twig create mode 100644 Views/CustomField/_detail_right_section.html.twig delete mode 100644 Views/CustomField/detail.html.php create mode 100644 Views/CustomField/detail.html.twig delete mode 100644 Views/CustomField/form.html.php create mode 100644 Views/CustomField/form.html.twig delete mode 100644 Views/CustomField/index.html.php delete mode 100644 Views/CustomField/value.html.php create mode 100644 Views/CustomField/value.html.twig create mode 100644 Views/CustomItem/_detail_left_section.html.twig create mode 100644 Views/CustomItem/_detail_right_section.html.twig create mode 100644 Views/CustomItem/_list.html.twig delete mode 100644 Views/CustomItem/detail.html.php create mode 100644 Views/CustomItem/detail.html.twig delete mode 100644 Views/CustomItem/form.html.php create mode 100644 Views/CustomItem/form.html.twig delete mode 100644 Views/CustomItem/index.html.php delete mode 100644 Views/CustomItem/list.html.php create mode 100644 Views/CustomItem/list.html.twig delete mode 100644 Views/CustomObject/Form/Panel/_field.html.php create mode 100644 Views/CustomObject/Form/Panel/_field.html.twig delete mode 100644 Views/CustomObject/Form/Panel/checkbox_group.html.php create mode 100644 Views/CustomObject/Form/Panel/checkbox_group.html.twig delete mode 100644 Views/CustomObject/Form/Panel/country.html.php create mode 100644 Views/CustomObject/Form/Panel/country.html.twig delete mode 100644 Views/CustomObject/Form/Panel/date.html.php create mode 100644 Views/CustomObject/Form/Panel/date.html.twig delete mode 100644 Views/CustomObject/Form/Panel/datetime.html.php create mode 100644 Views/CustomObject/Form/Panel/datetime.html.twig delete mode 100644 Views/CustomObject/Form/Panel/email.html.php create mode 100644 Views/CustomObject/Form/Panel/email.html.twig delete mode 100644 Views/CustomObject/Form/Panel/hidden.html.php create mode 100644 Views/CustomObject/Form/Panel/hidden.html.twig delete mode 100644 Views/CustomObject/Form/Panel/html_area.html.php create mode 100644 Views/CustomObject/Form/Panel/html_area.html.twig delete mode 100644 Views/CustomObject/Form/Panel/int.html.php create mode 100644 Views/CustomObject/Form/Panel/int.html.twig delete mode 100644 Views/CustomObject/Form/Panel/multiselect.html.php create mode 100644 Views/CustomObject/Form/Panel/multiselect.html.twig delete mode 100644 Views/CustomObject/Form/Panel/phone.html.php create mode 100644 Views/CustomObject/Form/Panel/phone.html.twig delete mode 100644 Views/CustomObject/Form/Panel/radio_group.html.php create mode 100644 Views/CustomObject/Form/Panel/radio_group.html.twig delete mode 100644 Views/CustomObject/Form/Panel/select.html.php create mode 100644 Views/CustomObject/Form/Panel/select.html.twig delete mode 100644 Views/CustomObject/Form/Panel/text.html.php create mode 100644 Views/CustomObject/Form/Panel/text.html.twig delete mode 100644 Views/CustomObject/Form/Panel/textarea.html.php create mode 100644 Views/CustomObject/Form/Panel/textarea.html.twig delete mode 100644 Views/CustomObject/Form/Panel/url.html.php create mode 100644 Views/CustomObject/Form/Panel/url.html.twig create mode 100644 Views/CustomObject/_detail_left_section.html.twig create mode 100644 Views/CustomObject/_detail_right_section.html.twig delete mode 100644 Views/CustomObject/_form-fields.html.php create mode 100644 Views/CustomObject/_form-fields.html.twig create mode 100644 Views/CustomObject/_list.html.twig delete mode 100644 Views/CustomObject/detail.html.php create mode 100644 Views/CustomObject/detail.html.twig delete mode 100644 Views/CustomObject/form.html.php create mode 100644 Views/CustomObject/form.html.twig delete mode 100644 Views/CustomObject/index.html.php delete mode 100644 Views/CustomObject/list.html.php create mode 100644 Views/CustomObject/list.html.twig rename Views/FormTheme/FieldValueCondition/{campaign_condition_field_value_widget.html.php => campaign_condition_field_value_widget.html.twig} (100%) delete mode 100644 Views/SubscribedEvents/Tab/content.html.php create mode 100644 Views/SubscribedEvents/Tab/content.html.twig delete mode 100644 Views/SubscribedEvents/Tab/link.html.php create mode 100644 Views/SubscribedEvents/Tab/link.html.twig delete mode 100644 Views/SubscribedEvents/Tab/modal.html.php create mode 100644 Views/SubscribedEvents/Tab/modal.html.twig delete mode 100644 Views/SubscribedEvents/Timeline/link.html.php create mode 100644 Views/SubscribedEvents/Timeline/link.html.twig diff --git a/Controller/CustomField/FormController.php b/Controller/CustomField/FormController.php index a2342f093..eaeacd1c5 100644 --- a/Controller/CustomField/FormController.php +++ b/Controller/CustomField/FormController.php @@ -114,7 +114,7 @@ public function renderFormAction(Request $request): Response 'customField' => $customField, 'form' => $form->createView(), ], - 'contentTemplate' => 'CustomObjectsBundle:CustomField:form.html.php', + 'contentTemplate' => 'CustomObjectsBundle:CustomField:form.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customField', 'route' => $route, diff --git a/Controller/CustomField/SaveController.php b/Controller/CustomField/SaveController.php index 7aff22a2f..49ee80ca7 100644 --- a/Controller/CustomField/SaveController.php +++ b/Controller/CustomField/SaveController.php @@ -134,7 +134,7 @@ public function saveAction(Request $request) 'customField' => $customField, 'form' => $form->createView(), ], - 'contentTemplate' => 'CustomObjectsBundle:CustomField:form.html.php', + 'contentTemplate' => 'CustomObjectsBundle:CustomField:form.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customField', 'route' => $route, @@ -178,7 +178,7 @@ private function buildSuccessForm(CustomObject $customObject, CustomField $custo ); $template = $this->render( - 'CustomObjectsBundle:CustomObject:_form-fields.html.php', + 'CustomObjectsBundle:CustomObject:_form-fields.html.twig', [ 'form' => $form->createView(), 'panelId' => $panelId, // Panel id to me replaced if edit diff --git a/Controller/CustomItem/FormController.php b/Controller/CustomItem/FormController.php index 5be8c013e..e1adbfc0f 100644 --- a/Controller/CustomItem/FormController.php +++ b/Controller/CustomItem/FormController.php @@ -214,7 +214,7 @@ private function renderFormForItem(CustomItem $customItem, string $route, ?int $ 'customObject' => $customItem->getCustomObject(), 'form' => $form->createView(), ], - 'contentTemplate' => 'CustomObjectsBundle:CustomItem:form.html.php', + 'contentTemplate' => 'CustomObjectsBundle:CustomItem:form.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customItem', 'route' => $route, diff --git a/Controller/CustomItem/LinkFormController.php b/Controller/CustomItem/LinkFormController.php index 763778af4..cc2076b47 100644 --- a/Controller/CustomItem/LinkFormController.php +++ b/Controller/CustomItem/LinkFormController.php @@ -95,7 +95,7 @@ public function formAction(int $itemId, string $entityType, int $entityId): Resp 'customObject' => $relationshipObject, 'form' => $form->createView(), ], - 'contentTemplate' => 'CustomObjectsBundle:CustomItem:form.html.php', + 'contentTemplate' => 'CustomObjectsBundle:CustomItem:form.html.twig', 'passthroughVars' => [ 'callback' => 'customItemLinkFormLoad', 'mauticContent' => 'customItem', @@ -109,7 +109,7 @@ public function formAction(int $itemId, string $entityType, int $entityId): Resp $responseData = [ 'closeModal' => true, - 'flashes' => $this->renderView('MauticCoreBundle:Notification:flash_messages.html.php'), + 'flashes' => $this->renderView('MauticCoreBundle:Notification:flash_messages.html.twig'), ]; return new JsonResponse($responseData); @@ -152,7 +152,7 @@ public function saveAction(int $itemId, string $entityType, int $entityId): Resp $responseData = [ 'closeModal' => true, 'callback' => $callback, - 'flashes' => $this->renderView('MauticCoreBundle:Notification:flash_messages.html.php'), + 'flashes' => $this->renderView('MauticCoreBundle:Notification:flash_messages.html.twig'), ]; return new JsonResponse($responseData); @@ -170,7 +170,7 @@ public function saveAction(int $itemId, string $entityType, int $entityId): Resp 'form' => $form->createView(), 'tmpl' => $this->request->isXmlHttpRequest() ? $this->request->get('tmpl', 'index') : 'index', ], - 'contentTemplate' => 'CustomObjectsBundle:CustomItem:form.html.php', + 'contentTemplate' => 'CustomObjectsBundle:CustomItem:form.html.twig', 'passthroughVars' => [ 'closeModal' => false, 'callback' => 'customItemLinkFormLoad', diff --git a/Controller/CustomItem/ListController.php b/Controller/CustomItem/ListController.php index 3dfed2e3e..000780a83 100644 --- a/Controller/CustomItem/ListController.php +++ b/Controller/CustomItem/ListController.php @@ -124,7 +124,7 @@ public function listAction(int $objectId, int $page = 1): Response 'sessionVar' => $namespace, 'namespace' => $namespace, ], - 'contentTemplate' => 'CustomObjectsBundle:CustomItem:list.html.php', + 'contentTemplate' => 'CustomObjectsBundle:CustomItem:list.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customItem', 'route' => $filterEntityType ? null : $route, diff --git a/Controller/CustomItem/SaveController.php b/Controller/CustomItem/SaveController.php index eea863601..577db435b 100644 --- a/Controller/CustomItem/SaveController.php +++ b/Controller/CustomItem/SaveController.php @@ -203,7 +203,7 @@ public function saveAction(int $objectId, ?int $itemId = null): Response 'form' => $form->createView(), 'tmpl' => $request->isXmlHttpRequest() ? $request->get('tmpl', 'index') : 'index', ], - 'contentTemplate' => 'CustomObjectsBundle:CustomItem:form.html.php', + 'contentTemplate' => 'CustomObjectsBundle:CustomItem:form.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customItem', 'route' => $route, diff --git a/Controller/CustomItem/ViewController.php b/Controller/CustomItem/ViewController.php index c29166ba9..1386cd811 100644 --- a/Controller/CustomItem/ViewController.php +++ b/Controller/CustomItem/ViewController.php @@ -114,7 +114,7 @@ public function viewAction(int $objectId, int $itemId): Response ] )->getContent(), ], - 'contentTemplate' => 'CustomObjectsBundle:CustomItem:detail.html.php', + 'contentTemplate' => 'CustomObjectsBundle:CustomItem:detail.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customItem', 'activeLink' => "#mautic_custom_object_{$objectId}", diff --git a/Controller/CustomObject/FormController.php b/Controller/CustomObject/FormController.php index 5d3284d6e..20e2229f1 100644 --- a/Controller/CustomObject/FormController.php +++ b/Controller/CustomObject/FormController.php @@ -144,7 +144,7 @@ private function renderForm(CustomObject $customObject, string $route): Response 'deletedFields' => [], 'form' => $form->createView(), ], - 'contentTemplate' => 'CustomObjectsBundle:CustomObject:form.html.php', + 'contentTemplate' => 'CustomObjectsBundle:CustomObject:form.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customObject', 'route' => $route, diff --git a/Controller/CustomObject/ListController.php b/Controller/CustomObject/ListController.php index ab8af89b5..a3d26e350 100644 --- a/Controller/CustomObject/ListController.php +++ b/Controller/CustomObject/ListController.php @@ -98,7 +98,7 @@ public function listAction(int $page = 1): Response 'tmpl' => $request->isXmlHttpRequest() ? $request->get('tmpl', 'index') : 'index', 'sessionVar' => $sessionProvider->getNamespace(), ], - 'contentTemplate' => 'CustomObjectsBundle:CustomObject:list.html.php', + 'contentTemplate' => 'CustomObjectsBundle:CustomObject:list.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customObject', 'route' => $route, diff --git a/Controller/CustomObject/SaveController.php b/Controller/CustomObject/SaveController.php index c77f2dd52..e521a3385 100644 --- a/Controller/CustomObject/SaveController.php +++ b/Controller/CustomObject/SaveController.php @@ -180,7 +180,7 @@ public function saveAction(?int $objectId = null): Response 'deletedFields' => [], 'form' => $form->createView(), ], - 'contentTemplate' => 'CustomObjectsBundle:CustomObject:form.html.php', + 'contentTemplate' => 'CustomObjectsBundle:CustomObject:form.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customObject', 'route' => $objectId ? $this->routeProvider->buildEditRoute($customObject->getId()) : $this->routeProvider->buildNewRoute(), diff --git a/Controller/CustomObject/ViewController.php b/Controller/CustomObject/ViewController.php index 222e5ee66..15d4ddda7 100644 --- a/Controller/CustomObject/ViewController.php +++ b/Controller/CustomObject/ViewController.php @@ -104,7 +104,7 @@ public function viewAction(int $objectId): Response 'stats' => $stats, 'logs' => $auditLogs, ], - 'contentTemplate' => 'CustomObjectsBundle:CustomObject:detail.html.php', + 'contentTemplate' => 'CustomObjectsBundle:CustomObject:detail.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customObject', 'activeLink' => "#mautic_custom_object_{$objectId}", diff --git a/Controller/JsonController.php b/Controller/JsonController.php index 77a86d128..111e77d80 100644 --- a/Controller/JsonController.php +++ b/Controller/JsonController.php @@ -16,7 +16,7 @@ class JsonController extends Controller */ protected function renderJson(array $responseData = []): JsonResponse { - $responseData['flashes'] = $this->renderView('MauticCoreBundle:Notification:flash_messages.html.php'); + $responseData['flashes'] = $this->renderView('MauticCoreBundle:Notification:flash_messages.html.twig'); return new JsonResponse($responseData); } diff --git a/EventListener/ContactSubscriber.php b/EventListener/ContactSubscriber.php index 16e27da98..4f7d11c79 100644 --- a/EventListener/ContactSubscriber.php +++ b/EventListener/ContactSubscriber.php @@ -142,7 +142,7 @@ private function addLinkTimelineEntry(LeadTimelineEvent $event, string $eventTyp 'icon' => "fa-{$action}", 'extra' => $link, 'contactId' => $link['lead_id'], - 'contentTemplate' => 'CustomObjectsBundle:SubscribedEvents\Timeline:link.html.php', + 'contentTemplate' => 'CustomObjectsBundle:SubscribedEvents\Timeline:link.html.twig', ]); } } diff --git a/EventListener/ContactTabSubscriber.php b/EventListener/ContactTabSubscriber.php index 70ec02190..b3bc1a159 100644 --- a/EventListener/ContactTabSubscriber.php +++ b/EventListener/ContactTabSubscriber.php @@ -85,7 +85,7 @@ public function injectTabs(CustomContentEvent $event): void return; } - if ($event->checkContext('MauticLeadBundle:Lead:lead.html.php', 'tabs')) { + if ($event->checkContext('MauticLeadBundle:Lead:lead.html.twig', 'tabs')) { $vars = $event->getVars(); $objects = $this->customObjectModel->getMasterCustomObjects(); @@ -100,13 +100,13 @@ public function injectTabs(CustomContentEvent $event): void 'tabId' => "custom-object-{$object->getId()}", ]; - $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:link.html.php', $data); + $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:link.html.twig', $data); } - $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:modal.html.php'); + $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:modal.html.twig'); } - if ($event->checkContext('MauticLeadBundle:Lead:lead.html.php', 'tabs.content')) { + if ($event->checkContext('MauticLeadBundle:Lead:lead.html.twig', 'tabs.content')) { $vars = $event->getVars(); $objects = $this->getCustomObjects(); @@ -133,7 +133,7 @@ public function injectTabs(CustomContentEvent $event): void 'namespace' => $sessionProvider->getNamespace(), ]; - $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:content.html.php', $data); + $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:content.html.twig', $data); } } } diff --git a/EventListener/CustomItemTabSubscriber.php b/EventListener/CustomItemTabSubscriber.php index b80a5feb0..e76f2f98c 100644 --- a/EventListener/CustomItemTabSubscriber.php +++ b/EventListener/CustomItemTabSubscriber.php @@ -73,7 +73,7 @@ public static function getSubscribedEvents(): array public function injectTabs(CustomContentEvent $event): void { - if ($event->checkContext('CustomObjectsBundle:CustomItem:detail.html.php', 'tabs')) { + if ($event->checkContext('CustomObjectsBundle:CustomItem:detail.html.twig', 'tabs')) { $vars = $event->getVars(); $objects = $this->customObjectModel->getMasterCustomObjects(); @@ -92,13 +92,13 @@ public function injectTabs(CustomContentEvent $event): void 'tabId' => "custom-object-{$object->getId()}", ]; - $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:link.html.php', $data); + $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:link.html.twig', $data); } - $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:modal.html.php'); + $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:modal.html.twig'); } - if ($event->checkContext('CustomObjectsBundle:CustomItem:detail.html.php', 'tabs.content')) { + if ($event->checkContext('CustomObjectsBundle:CustomItem:detail.html.twig', 'tabs.content')) { $vars = $event->getVars(); $objects = $this->getCustomObjects(); @@ -129,7 +129,7 @@ public function injectTabs(CustomContentEvent $event): void 'namespace' => $sessionProvider->getNamespace(), ]; - $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:content.html.php', $data); + $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:content.html.twig', $data); } } } diff --git a/Tests/Unit/EventListener/ContactSubscriberTest.php b/Tests/Unit/EventListener/ContactSubscriberTest.php index 80718dbb6..ba00ea21e 100644 --- a/Tests/Unit/EventListener/ContactSubscriberTest.php +++ b/Tests/Unit/EventListener/ContactSubscriberTest.php @@ -176,7 +176,7 @@ public function testPluginEnabledOnPublicPageWhenItemFound(): void 'id' => 444, ], 'contactId' => 333, - 'contentTemplate' => 'CustomObjectsBundle:SubscribedEvents\Timeline:link.html.php', + 'contentTemplate' => 'CustomObjectsBundle:SubscribedEvents\Timeline:link.html.twig', ]); $this->subscriber->onTimelineGenerate($this->leadTimelineEvent); @@ -273,7 +273,7 @@ public function testPluginEnabledOnPublicPageWhenItemNotFound(): void 'id' => 444, ], 'contactId' => 333, - 'contentTemplate' => 'CustomObjectsBundle:SubscribedEvents\Timeline:link.html.php', + 'contentTemplate' => 'CustomObjectsBundle:SubscribedEvents\Timeline:link.html.twig', ]); $this->subscriber->onTimelineGenerate($this->leadTimelineEvent); diff --git a/Tests/Unit/EventListener/ContactTabSubscriberTest.php b/Tests/Unit/EventListener/ContactTabSubscriberTest.php index 62499bc83..20ef407d2 100644 --- a/Tests/Unit/EventListener/ContactTabSubscriberTest.php +++ b/Tests/Unit/EventListener/ContactTabSubscriberTest.php @@ -123,8 +123,8 @@ public function testForTabsContext(): void ->method('checkContext') ->willReturnMap( [ - ['MauticLeadBundle:Lead:lead.html.php', 'tabs', true], - ['MauticLeadBundle:Lead:lead.html.php', 'tabs.content', false], + ['MauticLeadBundle:Lead:lead.html.twig', 'tabs', true], + ['MauticLeadBundle:Lead:lead.html.twig', 'tabs.content', false], ] ); @@ -136,7 +136,7 @@ public function testForTabsContext(): void ->method('addTemplate') ->withConsecutive( [ - 'CustomObjectsBundle:SubscribedEvents/Tab:link.html.php', + 'CustomObjectsBundle:SubscribedEvents/Tab:link.html.twig', [ 'count' => 13, 'title' => 'Object A', @@ -144,7 +144,7 @@ public function testForTabsContext(): void ], ], [ - 'CustomObjectsBundle:SubscribedEvents/Tab:modal.html.php', + 'CustomObjectsBundle:SubscribedEvents/Tab:modal.html.twig', ] ); @@ -176,8 +176,8 @@ public function testForTabContentsContext(): void ->method('checkContext') ->willReturnMap( [ - ['MauticLeadBundle:Lead:lead.html.php', 'tabs', false], - ['MauticLeadBundle:Lead:lead.html.php', 'tabs.content', true], + ['MauticLeadBundle:Lead:lead.html.twig', 'tabs', false], + ['MauticLeadBundle:Lead:lead.html.twig', 'tabs.content', true], ] ); @@ -218,7 +218,7 @@ public function testForTabContentsContext(): void $this->customContentEvent->expects($this->once()) ->method('addTemplate') ->with( - 'CustomObjectsBundle:SubscribedEvents/Tab:content.html.php', + 'CustomObjectsBundle:SubscribedEvents/Tab:content.html.twig', [ 'customObjectId' => 555, 'currentEntityId' => 45, diff --git a/Tests/Unit/EventListener/CustomItemTabSubscriberTest.php b/Tests/Unit/EventListener/CustomItemTabSubscriberTest.php index 2e4e7bb5e..d6636a2be 100644 --- a/Tests/Unit/EventListener/CustomItemTabSubscriberTest.php +++ b/Tests/Unit/EventListener/CustomItemTabSubscriberTest.php @@ -105,8 +105,8 @@ public function testForTabsContext(): void $this->customContentEvent ->method('checkContext') ->withConsecutive( - ['CustomObjectsBundle:CustomItem:detail.html.php', 'tabs'], - ['CustomObjectsBundle:CustomItem:detail.html.php', 'tabs.content'] + ['CustomObjectsBundle:CustomItem:detail.html.twig', 'tabs'], + ['CustomObjectsBundle:CustomItem:detail.html.twig', 'tabs.content'] ) ->willReturnOnConsecutiveCalls(true, false); @@ -118,7 +118,7 @@ public function testForTabsContext(): void ->method('addTemplate') ->withConsecutive( [ - 'CustomObjectsBundle:SubscribedEvents/Tab:link.html.php', + 'CustomObjectsBundle:SubscribedEvents/Tab:link.html.twig', [ 'count' => 13, 'title' => 'Object A', @@ -126,7 +126,7 @@ public function testForTabsContext(): void ], ], [ - 'CustomObjectsBundle:SubscribedEvents/Tab:modal.html.php', + 'CustomObjectsBundle:SubscribedEvents/Tab:modal.html.twig', ] ); @@ -158,8 +158,8 @@ public function testForTabsContextWhenTheCustomItemMatchesCustomObject(): void $this->customContentEvent ->method('checkContext') ->withConsecutive( - ['CustomObjectsBundle:CustomItem:detail.html.php', 'tabs'], - ['CustomObjectsBundle:CustomItem:detail.html.php', 'tabs.content'] + ['CustomObjectsBundle:CustomItem:detail.html.twig', 'tabs'], + ['CustomObjectsBundle:CustomItem:detail.html.twig', 'tabs.content'] ) ->willReturn(true, false); @@ -169,7 +169,7 @@ public function testForTabsContextWhenTheCustomItemMatchesCustomObject(): void $this->customContentEvent->expects($this->once()) ->method('addTemplate') - ->with('CustomObjectsBundle:SubscribedEvents/Tab:modal.html.php'); + ->with('CustomObjectsBundle:SubscribedEvents/Tab:modal.html.twig'); $this->customObjectModel->expects($this->once()) ->method('getMasterCustomObjects') @@ -194,8 +194,8 @@ public function testForTabContentsContext(): void $this->customContentEvent ->method('checkContext') ->withConsecutive( - ['CustomObjectsBundle:CustomItem:detail.html.php', 'tabs'], - ['CustomObjectsBundle:CustomItem:detail.html.php', 'tabs.content'] + ['CustomObjectsBundle:CustomItem:detail.html.twig', 'tabs'], + ['CustomObjectsBundle:CustomItem:detail.html.twig', 'tabs.content'] ) ->willReturn(false, true); @@ -236,7 +236,7 @@ public function testForTabContentsContext(): void $this->customContentEvent->expects($this->once()) ->method('addTemplate') ->with( - 'CustomObjectsBundle:SubscribedEvents/Tab:content.html.php', + 'CustomObjectsBundle:SubscribedEvents/Tab:content.html.twig', [ 'customObjectId' => 555, 'currentEntityId' => 45, diff --git a/Views/CustomField/_detail_left_section.html.twig b/Views/CustomField/_detail_left_section.html.twig new file mode 100644 index 000000000..9b818961f --- /dev/null +++ b/Views/CustomField/_detail_left_section.html.twig @@ -0,0 +1,25 @@ + +
+
+ +
+
+
+
{{ item.type }}
+
+
+ {{ include('MauticCoreBundle:Helper:publishstatus_badge.html.twig', { + entity: item + }) }} +
+
+
+ +
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/Views/CustomField/_detail_right_section.html.twig b/Views/CustomField/_detail_right_section.html.twig new file mode 100644 index 000000000..0106b5102 --- /dev/null +++ b/Views/CustomField/_detail_right_section.html.twig @@ -0,0 +1,23 @@ + +
+ +
+
+
+ {{ 'mautic.webhook.webhook_url'|trans }} +
+
+
+
+
+ +
+ + + {{ include('MauticCoreBundle:Helper:recentactivity.html.twig', { + logs: logs + }) }} +
+
+ +
\ No newline at end of file diff --git a/Views/CustomField/detail.html.php b/Views/CustomField/detail.html.php deleted file mode 100644 index c97b8ac83..000000000 --- a/Views/CustomField/detail.html.php +++ /dev/null @@ -1,56 +0,0 @@ -extend('MauticCoreBundle:Default:content.html.php'); -$view['slots']->set('mauticContent', 'customField'); -$view['slots']->set('headerTitle', $item->getName()); -$view['slots']->set('actions', $view->render('MauticCoreBundle:Helper:page_actions.html.php', [ - 'item' => $item, -])); -?> - - -
- -
-
- -
-
-
-
getType(); ?>
-
-
- render('MauticCoreBundle:Helper:publishstatus_badge.html.php', ['entity' => $item]); ?> -
-
-
- -
-
-
-
-
-
-
-
- - -
- -
-
-
trans('mautic.webhook.webhook_url');?>
-
-
-
-
-
- -
- - - render('MauticCoreBundle:Helper:recentactivity.html.php', ['logs' => $logs]);?> -
-
- -
diff --git a/Views/CustomField/detail.html.twig b/Views/CustomField/detail.html.twig new file mode 100644 index 000000000..1ed2c0637 --- /dev/null +++ b/Views/CustomField/detail.html.twig @@ -0,0 +1,19 @@ +{% extends 'MauticCoreBundle:Default:content.html.twig.html.twig' %} + +{% block mauticContent %}customField{% endblock %} + +{% block headerTitle %} + {{ item.getName() }} +{% endblock %} + +{% block actions %} + {{ include('MauticCoreBundle:Helper:page_actions.html.twig', { 'item': item }) }} +{% endblock %} + +{% block content %} + +
+ {{ include('CustomObjectsBundle:CustomField:_detail_left_section.html.twig') }} + {{ include('CustomObjectsBundle:CustomField:_detail_right_section.html.twig', {'logs': logs}) }} +
+{% endblock %} \ No newline at end of file diff --git a/Views/CustomField/form.html.php b/Views/CustomField/form.html.php deleted file mode 100644 index 1ca60993e..000000000 --- a/Views/CustomField/form.html.php +++ /dev/null @@ -1,105 +0,0 @@ -getId() ? $customField->getLabel() : $customField->getTypeObject()->getName(); - -$showProperties = isset($form['options']) || $customField->getTypeObject()->usePlaceholder(); -?> - -
- -
-

-
- - start($form); ?> - -
- - - -
-
- -
-
- row($form['label']); ?> -
-
- row($form['showInCustomObjectDetailList']); ?> -
-
- -
-
- row($form['alias']); ?> -
-
- row($form['showInContactDetailList']); ?> -
-
- -
-
- row($form['defaultValue']); ?> -
-
- row($form['isUniqueIdentifier']); ?> -
-
- -
- -
-
-
- row($form['required']); ?> -
-
-
- - -
-
- -
- row($form['options']); ?> -
- -
-
-getTypeObject()->usePlaceholder()): ?> -
- row($form['params']['placeholder']); ?> -
- -
-
- - -
- -
- - rest($form); ?> - end($form); ?> - -
\ No newline at end of file diff --git a/Views/CustomField/form.html.twig b/Views/CustomField/form.html.twig new file mode 100644 index 000000000..a8e398dfc --- /dev/null +++ b/Views/CustomField/form.html.twig @@ -0,0 +1,97 @@ +{% set title = customField.id ? customField.label : customField.typeObject.name %} +{% set showProperties = form.options or customField.typeObject.placeholder %} + +{% block content %} +
+
+

{{ title }}

+
+ + {{ form_start(form) }} +
+ + +
+
+ +
+
+ {{ form_label(form, label) }} +
+
+ {{ form_row(form.showInCustomObjectDetailList) }} +
+
+ +
+
+ {{ form_row(form.alias) }} +
+
+ {{ form_row(form.showInContactDetailList) }} +
+
+ +
+
+ {{ form_row(form.defaultValue) }} +
+
+ {{ form_row(form.isUniqueIdentifier) }} +
+
+ +
+ +
+
+
+ {{ form_row(form.required) }} +
+
+
+ + {% if showProperties %} +
+
+ {% if form.options is defined %} +
+ {{ form_row(form.options) }} +
+ {% endif %} +
+
+ {% if customField.typeObject.usePlaceholder %} +
+ {{ form_row(form.params.placeholder) }} +
+ {% endif %} +
+
+ {% endif %} +
+
+ + {{ form_rest(form) }} + {{ form_end(form) }} + +
+{% endblock %} \ No newline at end of file diff --git a/Views/CustomField/index.html.php b/Views/CustomField/index.html.php deleted file mode 100644 index c1a0aaa20..000000000 --- a/Views/CustomField/index.html.php +++ /dev/null @@ -1,21 +0,0 @@ -extend('MauticCoreBundle:Default:content.html.php'); - -$view['slots']->set('mauticContent', 'customField'); -$view['slots']->set('headerTitle', $view['translator']->trans('custom.field.title')); -$view['slots']->set('actions', $view->render('MauticCoreBundle:Helper:page_actions.html.php')); -?> - -
- render( - 'MauticCoreBundle:Helper:list_toolbar.html.php', - [ - // 'searchValue' => $searchValue, - // 'action' => $currentRoute, - ] -); ?> -
- output('_content'); ?> -
-
diff --git a/Views/CustomField/value.html.php b/Views/CustomField/value.html.php deleted file mode 100644 index 35be77316..000000000 --- a/Views/CustomField/value.html.php +++ /dev/null @@ -1,23 +0,0 @@ -getCustomField()->getType(); -?> -getValue() instanceof DateTimeInterface) : ?> - - toDate($fieldValue->getValue()); ?> - - toFull($fieldValue->getValue()); ?> - - - escape($fieldValue->getCustomField()->getTypeObject()->valueToString($fieldValue)); ?> -getValue())) : ?> - escape($view['formatter']->arrayToString($fieldValue->getValue())); ?> - - escape($fieldValue->getValue()); ?> - \ No newline at end of file diff --git a/Views/CustomField/value.html.twig b/Views/CustomField/value.html.twig new file mode 100644 index 000000000..d719533d2 --- /dev/null +++ b/Views/CustomField/value.html.twig @@ -0,0 +1,14 @@ +{% set customFieldType = fieldValue.customField.type %} +{% set fieldTypes = ['select', 'multiselect'] %} + +{% if fieldValue.getValue() is instanceof('DateTimeInterface') %} + {% set date = 'date' == customFieldType ? dateToDate(fieldValue.getValue()) : dateToFull(fieldValue.getValue()) %} + {{ date }} +{% elseif customFieldType in fieldTypes %} +{# TODO: Transform to string #} + {{ '%s'|format(fieldValue|escape)|raw }} +{% elseif fieldValue.getValue() is iterable %} + {{ fieldValue.getValue()|join(', ') }} +{% else %} + {{ '%s'|format(fieldValue.getValue()|escape)|raw }} +{% endif %} \ No newline at end of file diff --git a/Views/CustomItem/_detail_left_section.html.twig b/Views/CustomItem/_detail_left_section.html.twig new file mode 100644 index 000000000..95edd0d9b --- /dev/null +++ b/Views/CustomItem/_detail_left_section.html.twig @@ -0,0 +1,112 @@ + +
+
+ +
+
+
+
+ {% set nameSingular = item.getCustomObject().getNameSingular() %} + {{ '%s'|format(nameSingular|escape)|raw }} +
+
+ {# TODO: Check if this block is needed #} +
+ {{ include('MauticCoreBundle:Helper:publishstatus_badge.html.twig', { + entity: item + }) }} +
+
+
+ +
+
+
+ + + {{ include('MauticCoreBundle:Helper:details.html.twig', { + entity: item + }) }} + {% for fieldValue in item.getCustomFieldValues() %} + + + + + {% endfor %} + +
{{ '%s'|format(fieldValue.getCustomField().getName()|escape)|raw }} + {{ include('CustomObjectsBundle:CustomField:value.html.twig', { + fieldValue: fieldValue + }) }} +
+
+
+
+
+ + +
+ + + + +
+
+
+
+
+
+
+ + {{ 'custom.item.links.in.time'|trans }} +
+
+
+ {{ include('MauticCoreBundle:Helper:graph_dateselect.html.twig', { + dateRangeForm: dateRangeForm, + class: 'pull-right' + }) }} +
+
+
+ {{ include('MauticCoreBundle:Helper:chart.html.twig', { + chartData: stats, + chartType: 'line', + chartHeight: 300 + }) }} +
+
+
+
+
+ {{ customContent('details.stats.graph.below', mauticTemplateVars is defined ? mauticTemplateVars : []) }} +
+ + + + + + +
+
+ +
+ {{ customContent('tabs.content', mauticTemplateVars is defined ? mauticTemplateVars : []) }} +
+ +
\ No newline at end of file diff --git a/Views/CustomItem/_detail_right_section.html.twig b/Views/CustomItem/_detail_right_section.html.twig new file mode 100644 index 000000000..823880988 --- /dev/null +++ b/Views/CustomItem/_detail_right_section.html.twig @@ -0,0 +1,6 @@ + +
+ + {{ include('MauticCoreBundle:Helper:recentactivity.html.twig', {'logs': logs}) }} +
+ \ No newline at end of file diff --git a/Views/CustomItem/_list.html.twig b/Views/CustomItem/_list.html.twig new file mode 100644 index 000000000..d0f2da4c4 --- /dev/null +++ b/Views/CustomItem/_list.html.twig @@ -0,0 +1,97 @@ +{% set tableAlias = constant('MauticPlugin\\CustomObjectsBundle\\Entity\\CustomObject::TABLE_ALIAS') %} +{% set routeView = constant('MauticPlugin\\CustomObjectsBundle\\Provider\\CustomObjectRouteProvider::ROUTE_VIEW') %} +{% set routeList = constant('MauticPlugin\\CustomObjectsBundle\\Provider\\CustomObjectRouteProvider::ROUTE_LIST') %} + +{% set routerSelf = path(routeList, { + 'objectId': customObject.getId(), + 'filterEntityId': filterEntityId, + 'filterEntityType': filterEntityType, + 'lookup': lookup, + 'tmpl': 'list', +}) %} + +{% if items|length %} +
+ + + + {{- include('MauticCoreBundle:Helper:tableheader.html.twig', { + 'checkall' : 'true', + 'target' : target, + 'langVar' : 'custom.item', + 'routeBase' : 'custom_item', + 'baseUrl' : routerSelf + }) -}} + {{- include('MauticCoreBundle:Helper:tableheader.html.twig', { + 'sessionVar' : sessionVar, + 'orderBy' : tableAlias~'.name', + 'text' : 'mautic.core.name', + 'class' : 'col-custom_item_name', + 'baseUrl' : routerSelf, + 'target' : target + }) -}} + {{- include('MauticCoreBundle:Helper:tableheader.html.twig', { + 'sessionVar' : sessionVar, + 'orderBy' : tableAlias~'.id', + 'text' : 'mautic.core.id', + 'default' : true, + 'baseUrl' : routerSelf, + 'target' : target + }) -}} + + {% if fieldData is not empty %} + {% for columnLabel in fieldData.getColumnLabels() %} + {{- include('MauticCoreBundle:Helper:tableheader.html.twig', { 'text' : columnLabel }) -}} + {% endfor %} + {% endif %} + + + + {% for item in items %} + + + + + {% if fieldData is not empty %} + {% for fieldValue in fieldData.getFields(item.getId()) %} + + {% endfor %} + {% endif %} + + {% endfor %} + +
+ {{- include('MauticCoreBundle:Helper:list_actions.html.twig', { 'item' : item }) -}} + +
+ {{ filterEntityId is empty ? include('MauticCoreBundle:Helper:publishstatus_icon.html.twig', { 'item' : item, 'model' : 'custom.item' }) : '' }} + + {{ item.getName() }} + +
+
+ {{ item.getId() }} + + {{- include('CustomObjectsBundle:CustomField:value.html.twig', { 'fieldValue' : fieldValue }) -}} +
+
+ +{% else %} + {{- include('MauticCoreBundle:Helper:noresults.html.twig', { 'tip' : lookup ? 'custom.item.link.noresults.tip' : 'custom.object.noresults.tip' }) -}} +{% endif %} diff --git a/Views/CustomItem/detail.html.php b/Views/CustomItem/detail.html.php deleted file mode 100644 index 25b27e74e..000000000 --- a/Views/CustomItem/detail.html.php +++ /dev/null @@ -1,125 +0,0 @@ -extend('MauticCoreBundle:Default:content.html.php'); -$view['slots']->set('mauticContent', 'customItem'); -$view['slots']->set('headerTitle', $item->getName()); -$view['slots']->set('actions', $view->render('MauticCoreBundle:Helper:page_actions.html.php', [ - 'item' => $item, -])); -?> - - -
- -
-
- -
-
-
-
escape($item->getCustomObject()->getNameSingular()); ?>
-
-
- render('MauticCoreBundle:Helper:publishstatus_badge.html.php', ['entity' => $item]); ?> -
-
-
- - -
-
-
- - - render( - 'MauticCoreBundle:Helper:details.html.php', - ['entity' => $item] -); ?> - getCustomFieldValues() as $fieldValue) : ?> - - - - - - -
escape($fieldValue->getCustomField()->getName()); ?> - render('CustomObjectsBundle:CustomField:value.html.php', ['fieldValue' => $fieldValue]); ?> -
-
-
-
-
- - -
- - - - -
-
-
-
-
-
-
- - trans('custom.item.links.in.time'); ?> -
-
-
- render( - 'MauticCoreBundle:Helper:graph_dateselect.html.php', - ['dateRangeForm' => $dateRangeForm, 'class' => 'pull-right'] -); ?> -
-
-
- render( - 'MauticCoreBundle:Helper:chart.html.php', - ['chartData' => $stats, 'chartType' => 'line', 'chartHeight' => 300] -); ?> -
-
-
-
-
- - getCustomContent('details.stats.graph.below', $mauticTemplateVars); ?> -
- - - - - - -
-
- -
- getCustomContent('tabs.content', $mauticTemplateVars); ?> -
- -
- - -
- - render('MauticCoreBundle:Helper:recentactivity.html.php', ['logs' => $logs]); ?> -
- -
diff --git a/Views/CustomItem/detail.html.twig b/Views/CustomItem/detail.html.twig new file mode 100644 index 000000000..92051b187 --- /dev/null +++ b/Views/CustomItem/detail.html.twig @@ -0,0 +1,27 @@ +{% extends 'MauticCoreBundle:Default:content.html.twig' %} + +{% block mauticContent %}customItem{% endblock %} + +{% block headerTitle %} + {{ item.getName() }} +{% endblock %} + +{% block actions %} + {{ include('MauticCoreBundle:Helper:page_actions.html.twig', { 'item': item }) }} +{% endblock %} + +{% block publishStatus %} + {{- include('MauticCoreBundle:Helper:publishstatus_badge.html.twig', {'entity' : item}) -}} +{% endblock %} + +{% block content %} +
+ {{ include('CustomObjectsBundle:CustomItem:_detail_left_section.html.twig', { + 'entity': item, + 'dateRangeForm': dateRangeForm, + 'chartData': stats, + 'mauticTemplateVars': mauticTemplateVars is defined ? mauticTemplateVars : {} + }) }} + {{ include('CustomObjectsBundle:CustomItem:_detail_right_section.html.twig', {'logs': logs}) }} +
+{% endblock %} diff --git a/Views/CustomItem/form.html.php b/Views/CustomItem/form.html.php deleted file mode 100644 index c39a6f0b7..000000000 --- a/Views/CustomItem/form.html.php +++ /dev/null @@ -1,71 +0,0 @@ -extend('MauticCoreBundle:Default:content.html.php'); - -$view['slots']->set('mauticContent', 'customItem'); - -if ($entity->getId()) { - $header = $view['translator']->trans( - 'custom.item.edit', - [ - '%object%' => $view['translator']->trans($customObject->getNameSingular()), - '%item%' => $view['translator']->trans($entity->getName()), - ] - ); -} else { - $header = $view['translator']->trans( - 'custom.item.new', - ['%object%' => $view['translator']->trans($customObject->getNameSingular())] - ); -} - -$view['slots']->set('headerTitle', $header); - -$hideCategories = CustomObject::TYPE_RELATIONSHIP === $customObject->getType() ? 'hide' : null; -?> - -start($form); ?> - - -
- -
-
-
-
- rowIfExists($form, 'name'); ?> - row($form['custom_field_values']); ?> - row($form['contact_id']); ?> -
- getRelationshipObject() && !empty($form['contact_id']->vars['value'])) : ?> -
-
-
-

- trans( - 'custom.item.new', - ['%object%' => $view['translator']->trans($customObject->getRelationshipObject()->getNameSingular())] -); ?> -

-
-
- rowIfExists($form, 'child_custom_field_values'); ?> -
-
-
- -
-
-
-
-
- row($form['category']); ?> - row($form['isPublished']); ?> -
-
-
- -end($form); ?> diff --git a/Views/CustomItem/form.html.twig b/Views/CustomItem/form.html.twig new file mode 100644 index 000000000..822c1fccf --- /dev/null +++ b/Views/CustomItem/form.html.twig @@ -0,0 +1,55 @@ +{% extends 'MauticCoreBundle:Default:content.html.twig' %} + +{% block mauticContent %}customItem{% endblock %} + +{% block headerTitle %} + {% if entity.getId() is empty %} + {{ 'custom.item.new'|trans({'%object%' : customObject.getNameSingular()}) }} + {% else %} + {{ 'custom.item.edit'|trans({'%object%' : customObject.getNameSingular(), '%item%' : entity.getName()}) }} + {% endif %} +{% endblock %} + +{% block content %} + {% set typeRelationship = constant('MauticPlugin\\CustomObjectsBundle\\Entity\\CustomObject::TYPE_RELATIONSHIP') %} + {% set hideCategories = typeRelationship == customObject.getType() ? 'hide' : null %} + {% set fields = form.children %} + + {{ form_start(form) }} + +
+ +
+
+
+
+ {%- if form.name is defined %}{{ form_row(form.name) }}{% endif %} + {{ form_row(form.custom_field_values) }} + {{ form_row(form.contact_id) }} +
+ {% if customObject.getRelationshipObject() is not empty and form.contact_id.value is not empty %} +
+
+
+

+ {{ 'custom.item.new'|trans({'%object%' : customObject.getRelationshipObject().getNameSingular()}) }} +

+
+
+ {{ formRowIfExists(fields, 'child_custom_field_values', template) }} +
+
+
+ {% endif %} +
+
+
+
+
+ {{ form_row(form.category) }} + {{ form_row(form.isPublished) }} +
+
+
+ {{ form_end(form) }} +{% endblock %} \ No newline at end of file diff --git a/Views/CustomItem/index.html.php b/Views/CustomItem/index.html.php deleted file mode 100644 index a8cf67cb5..000000000 --- a/Views/CustomItem/index.html.php +++ /dev/null @@ -1,27 +0,0 @@ -extend('MauticCoreBundle:Default:content.html.php'); - - $view['slots']->set('mauticContent', 'customItem'); - $view['slots']->set('headerTitle', $customObject->getName()); - $view['slots']->set('actions', $view->render('MauticCoreBundle:Helper:page_actions.html.php')); -} -?> - -
-
- render( - 'MauticCoreBundle:Helper:list_toolbar.html.php', - [ - 'searchValue' => $searchValue, - 'action' => $currentRoute, - 'target' => '#'.$namespace, - 'overlayDisabled' => $lookup, - ] -); ?> -
- output('_content'); ?> -
-
-
diff --git a/Views/CustomItem/list.html.php b/Views/CustomItem/list.html.php deleted file mode 100644 index 317d6deb4..000000000 --- a/Views/CustomItem/list.html.php +++ /dev/null @@ -1,124 +0,0 @@ -extend('CustomObjectsBundle:CustomItem:index.html.php'); -} - -$target = '#'.$namespace; -$routeSelf = $view['router']->path( - CustomItemRouteProvider::ROUTE_LIST, - [ - 'objectId' => $customObject->getId(), - 'filterEntityId' => $filterEntityId, - 'filterEntityType' => $filterEntityType, - 'lookup' => $lookup, - 'tmpl' => 'list', - ] -); -?> - -
- - - - render( - 'MauticCoreBundle:Helper:tableheader.html.php', - [ - 'checkall' => 'true', - 'target' => $target, - 'langVar' => 'custom.item', - 'routeBase' => 'custom_item', - 'baseUrl' => $routeSelf, - ] -); - - echo $view->render( - 'MauticCoreBundle:Helper:tableheader.html.php', - [ - 'sessionVar' => $sessionVar, - 'orderBy' => CustomItem::TABLE_ALIAS.'.name', - 'text' => 'mautic.core.name', - 'class' => 'col-custom_item_name', - 'baseUrl' => $routeSelf, - 'target' => $target, - ] - ); - - echo $view->render( - 'MauticCoreBundle:Helper:tableheader.html.php', - [ - 'sessionVar' => $sessionVar, - 'orderBy' => CustomItem::TABLE_ALIAS.'.id', - 'text' => 'mautic.core.id', - 'default' => true, - 'baseUrl' => $routeSelf, - 'target' => $target, - ] - ); - ?> - - getColumnLabels() as $columnLabel): ?> - render('MauticCoreBundle:Helper:tableheader.html.php', ['text' => $columnLabel]); ?> - - - - - - - - - - - - getFields($item->getId()) as $fieldValue): ?> - - - - - - -
- render('MauticCoreBundle:Helper:list_actions.html.php', ['item' => $item]); ?> - -
- render( - 'MauticCoreBundle:Helper:publishstatus_icon.html.php', - [ - 'item' => $item, - 'model' => 'custom.item', - ] - ) : ''; ?> - - getName(); ?> - -
-
getId(); ?> - render('CustomObjectsBundle:CustomField:value.html.php', ['fieldValue' => $fieldValue]); ?> -
-
- - - render('MauticCoreBundle:Helper:noresults.html.php', ['tip' => $lookup ? 'custom.item.link.noresults.tip' : 'custom.object.noresults.tip']); ?> - diff --git a/Views/CustomItem/list.html.twig b/Views/CustomItem/list.html.twig new file mode 100644 index 000000000..8d3e36bfd --- /dev/null +++ b/Views/CustomItem/list.html.twig @@ -0,0 +1,37 @@ +{% set isIndex = tmpl == 'index' ? true : false %} +{% set tmpl = 'list' %} +{% set fieldData = fieldData ?? null %} +{% set target = '#'~namespace %} + +{% extends isIndex ? 'MauticCoreBundle:Default:content.html.twig' : 'MauticCoreBundle:Default:raw_output.html.twig' %} + +{% block mauticContent %}customItem{% endblock %} + +{% block headerTitle %} + {{ customObject.getName() }} +{% endblock %} + +{% block actions %} + {{ include('MauticCoreBundle:Helper:page_actions.html.twig') }} +{% endblock %} + +{% block content %} +
+ {% if isIndex %} +
+ {{ include('MauticCoreBundle:Helper:list_toolbar.html.twig', { + 'searchValue': searchValue, + 'action': currentRoute, + 'target': '#'~namespace, + 'overlayDisabled': lookup + }) }} + +
+ {{ include('CustomObjectsBundle:CustomItem:_list.html.twig') }} +
+
+ {% else %} + {{ include('CustomObjectsBundle:CustomItem:_list.html.twig') }} + {% endif %} +
+{% endblock %} \ No newline at end of file diff --git a/Views/CustomObject/Form/Panel/_field.html.php b/Views/CustomObject/Form/Panel/_field.html.php deleted file mode 100644 index 97841a964..000000000 --- a/Views/CustomObject/Form/Panel/_field.html.php +++ /dev/null @@ -1,52 +0,0 @@ -vars['data']; -$customField->vars['index'] = $customField->vars['name']; -$order = (int) $customField->vars['value']->getOrder(); -$deleted = !empty($_POST['custom_object']['customFields'][$order]['deleted']) ? 'style="display:none;"' : ''; - -$panelId = !empty($panelId) ? $panelId : (int) $customField->vars['value']->getOrder(); -?> -
> - -
- - - - - - - -
- -
-
-
- row($customField['defaultValue']); ?> -
-
-
-
- rest($customField); ?> -
- -
\ No newline at end of file diff --git a/Views/CustomObject/Form/Panel/_field.html.twig b/Views/CustomObject/Form/Panel/_field.html.twig new file mode 100644 index 000000000..397e59bc0 --- /dev/null +++ b/Views/CustomObject/Form/Panel/_field.html.twig @@ -0,0 +1,47 @@ +{% set customFieldEntity = customField.vars.data %} +{#{% set customField.vars.index = customField.vars.name %}#} +{% set order = customField.vars.value.getOrder() %} +{#{{ dump(app.request.) }}#} +{# TODO !!!!!!!!!!!! Handle deleted objects#} +{#{% set requestCustomObject = app.request.post('custom_object') %}#} +{#{% set displayStyle = requestCustomObject['customFields'][order]['deleted'] is empty ? '' : 'style="display:none;"' %}#} +{% set displayStyle = '' %} +{% set panelId = panelId is empty ? customField.vars.value.getOrder()|number_format : panelId %} +{% set routeForm = constant('MauticPlugin\\CustomObjectsBundle\\Provider\\CustomFieldRouteProvider::ROUTE_FORM') %} + +
+
+ + + + + +
+ +
+
+
+ {{ form_row(customField.defaultValue) }} +
+
+
+
+ {{ form_rest(customField) }} +
+ +
\ No newline at end of file diff --git a/Views/CustomObject/Form/Panel/checkbox_group.html.php b/Views/CustomObject/Form/Panel/checkbox_group.html.php deleted file mode 100644 index 14616e6fc..000000000 --- a/Views/CustomObject/Form/Panel/checkbox_group.html.php +++ /dev/null @@ -1,5 +0,0 @@ -extend('CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.php'); diff --git a/Views/CustomObject/Form/Panel/checkbox_group.html.twig b/Views/CustomObject/Form/Panel/checkbox_group.html.twig new file mode 100644 index 000000000..0b2799f05 --- /dev/null +++ b/Views/CustomObject/Form/Panel/checkbox_group.html.twig @@ -0,0 +1 @@ +{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/country.html.php b/Views/CustomObject/Form/Panel/country.html.php deleted file mode 100644 index 14616e6fc..000000000 --- a/Views/CustomObject/Form/Panel/country.html.php +++ /dev/null @@ -1,5 +0,0 @@ -extend('CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.php'); diff --git a/Views/CustomObject/Form/Panel/country.html.twig b/Views/CustomObject/Form/Panel/country.html.twig new file mode 100644 index 000000000..0b2799f05 --- /dev/null +++ b/Views/CustomObject/Form/Panel/country.html.twig @@ -0,0 +1 @@ +{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/date.html.php b/Views/CustomObject/Form/Panel/date.html.php deleted file mode 100644 index 14616e6fc..000000000 --- a/Views/CustomObject/Form/Panel/date.html.php +++ /dev/null @@ -1,5 +0,0 @@ -extend('CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.php'); diff --git a/Views/CustomObject/Form/Panel/date.html.twig b/Views/CustomObject/Form/Panel/date.html.twig new file mode 100644 index 000000000..0b2799f05 --- /dev/null +++ b/Views/CustomObject/Form/Panel/date.html.twig @@ -0,0 +1 @@ +{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/datetime.html.php b/Views/CustomObject/Form/Panel/datetime.html.php deleted file mode 100644 index 14616e6fc..000000000 --- a/Views/CustomObject/Form/Panel/datetime.html.php +++ /dev/null @@ -1,5 +0,0 @@ -extend('CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.php'); diff --git a/Views/CustomObject/Form/Panel/datetime.html.twig b/Views/CustomObject/Form/Panel/datetime.html.twig new file mode 100644 index 000000000..0b2799f05 --- /dev/null +++ b/Views/CustomObject/Form/Panel/datetime.html.twig @@ -0,0 +1 @@ +{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/email.html.php b/Views/CustomObject/Form/Panel/email.html.php deleted file mode 100644 index 14616e6fc..000000000 --- a/Views/CustomObject/Form/Panel/email.html.php +++ /dev/null @@ -1,5 +0,0 @@ -extend('CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.php'); diff --git a/Views/CustomObject/Form/Panel/email.html.twig b/Views/CustomObject/Form/Panel/email.html.twig new file mode 100644 index 000000000..0b2799f05 --- /dev/null +++ b/Views/CustomObject/Form/Panel/email.html.twig @@ -0,0 +1 @@ +{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/hidden.html.php b/Views/CustomObject/Form/Panel/hidden.html.php deleted file mode 100644 index 14616e6fc..000000000 --- a/Views/CustomObject/Form/Panel/hidden.html.php +++ /dev/null @@ -1,5 +0,0 @@ -extend('CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.php'); diff --git a/Views/CustomObject/Form/Panel/hidden.html.twig b/Views/CustomObject/Form/Panel/hidden.html.twig new file mode 100644 index 000000000..0b2799f05 --- /dev/null +++ b/Views/CustomObject/Form/Panel/hidden.html.twig @@ -0,0 +1 @@ +{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/html_area.html.php b/Views/CustomObject/Form/Panel/html_area.html.php deleted file mode 100644 index 14616e6fc..000000000 --- a/Views/CustomObject/Form/Panel/html_area.html.php +++ /dev/null @@ -1,5 +0,0 @@ -extend('CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.php'); diff --git a/Views/CustomObject/Form/Panel/html_area.html.twig b/Views/CustomObject/Form/Panel/html_area.html.twig new file mode 100644 index 000000000..0b2799f05 --- /dev/null +++ b/Views/CustomObject/Form/Panel/html_area.html.twig @@ -0,0 +1 @@ +{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/int.html.php b/Views/CustomObject/Form/Panel/int.html.php deleted file mode 100644 index 14616e6fc..000000000 --- a/Views/CustomObject/Form/Panel/int.html.php +++ /dev/null @@ -1,5 +0,0 @@ -extend('CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.php'); diff --git a/Views/CustomObject/Form/Panel/int.html.twig b/Views/CustomObject/Form/Panel/int.html.twig new file mode 100644 index 000000000..0b2799f05 --- /dev/null +++ b/Views/CustomObject/Form/Panel/int.html.twig @@ -0,0 +1 @@ +{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/multiselect.html.php b/Views/CustomObject/Form/Panel/multiselect.html.php deleted file mode 100644 index 14616e6fc..000000000 --- a/Views/CustomObject/Form/Panel/multiselect.html.php +++ /dev/null @@ -1,5 +0,0 @@ -extend('CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.php'); diff --git a/Views/CustomObject/Form/Panel/multiselect.html.twig b/Views/CustomObject/Form/Panel/multiselect.html.twig new file mode 100644 index 000000000..0b2799f05 --- /dev/null +++ b/Views/CustomObject/Form/Panel/multiselect.html.twig @@ -0,0 +1 @@ +{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/phone.html.php b/Views/CustomObject/Form/Panel/phone.html.php deleted file mode 100644 index 14616e6fc..000000000 --- a/Views/CustomObject/Form/Panel/phone.html.php +++ /dev/null @@ -1,5 +0,0 @@ -extend('CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.php'); diff --git a/Views/CustomObject/Form/Panel/phone.html.twig b/Views/CustomObject/Form/Panel/phone.html.twig new file mode 100644 index 000000000..0b2799f05 --- /dev/null +++ b/Views/CustomObject/Form/Panel/phone.html.twig @@ -0,0 +1 @@ +{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/radio_group.html.php b/Views/CustomObject/Form/Panel/radio_group.html.php deleted file mode 100644 index 14616e6fc..000000000 --- a/Views/CustomObject/Form/Panel/radio_group.html.php +++ /dev/null @@ -1,5 +0,0 @@ -extend('CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.php'); diff --git a/Views/CustomObject/Form/Panel/radio_group.html.twig b/Views/CustomObject/Form/Panel/radio_group.html.twig new file mode 100644 index 000000000..0b2799f05 --- /dev/null +++ b/Views/CustomObject/Form/Panel/radio_group.html.twig @@ -0,0 +1 @@ +{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/select.html.php b/Views/CustomObject/Form/Panel/select.html.php deleted file mode 100644 index 14616e6fc..000000000 --- a/Views/CustomObject/Form/Panel/select.html.php +++ /dev/null @@ -1,5 +0,0 @@ -extend('CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.php'); diff --git a/Views/CustomObject/Form/Panel/select.html.twig b/Views/CustomObject/Form/Panel/select.html.twig new file mode 100644 index 000000000..0b2799f05 --- /dev/null +++ b/Views/CustomObject/Form/Panel/select.html.twig @@ -0,0 +1 @@ +{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/text.html.php b/Views/CustomObject/Form/Panel/text.html.php deleted file mode 100644 index 14616e6fc..000000000 --- a/Views/CustomObject/Form/Panel/text.html.php +++ /dev/null @@ -1,5 +0,0 @@ -extend('CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.php'); diff --git a/Views/CustomObject/Form/Panel/text.html.twig b/Views/CustomObject/Form/Panel/text.html.twig new file mode 100644 index 000000000..0b2799f05 --- /dev/null +++ b/Views/CustomObject/Form/Panel/text.html.twig @@ -0,0 +1 @@ +{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/textarea.html.php b/Views/CustomObject/Form/Panel/textarea.html.php deleted file mode 100644 index 14616e6fc..000000000 --- a/Views/CustomObject/Form/Panel/textarea.html.php +++ /dev/null @@ -1,5 +0,0 @@ -extend('CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.php'); diff --git a/Views/CustomObject/Form/Panel/textarea.html.twig b/Views/CustomObject/Form/Panel/textarea.html.twig new file mode 100644 index 000000000..4e16c7803 --- /dev/null +++ b/Views/CustomObject/Form/Panel/textarea.html.twig @@ -0,0 +1 @@ +{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} \ No newline at end of file diff --git a/Views/CustomObject/Form/Panel/url.html.php b/Views/CustomObject/Form/Panel/url.html.php deleted file mode 100644 index 14616e6fc..000000000 --- a/Views/CustomObject/Form/Panel/url.html.php +++ /dev/null @@ -1,5 +0,0 @@ -extend('CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.php'); diff --git a/Views/CustomObject/Form/Panel/url.html.twig b/Views/CustomObject/Form/Panel/url.html.twig new file mode 100644 index 000000000..0b2799f05 --- /dev/null +++ b/Views/CustomObject/Form/Panel/url.html.twig @@ -0,0 +1 @@ +{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/_detail_left_section.html.twig b/Views/CustomObject/_detail_left_section.html.twig new file mode 100644 index 000000000..da1812ab0 --- /dev/null +++ b/Views/CustomObject/_detail_left_section.html.twig @@ -0,0 +1,110 @@ + +
+
+ +
+
+
+
+
+
+ + + +
+
+
+ + + {{ include('MauticCoreBundle:Helper:details.html.twig', {'entity': customObject}) }} + +
+
+
+
+ +
+ + +
+ + + + +
+
+
+
+
+
+
+ + {{ 'custom.item.links.in.time'|trans }} +
+
+
+ {{ include('MauticCoreBundle:Helper:graph_dateselect.html.twig', {'dateRangeForm': dateRangeForm, 'class': 'pull-right'}) }} +
+
+
+ {{ include('MauticCoreBundle:Helper:chart.html.twig', {'chartData': chartData, 'chartType': 'line', 'chartHeight': 300}) }} +
+
+
+
+
+ {{- customContent('details.stats.graph.below', mauticTemplateVars|default({})) -}} + + + + +
+ +
+ + +
+
    + {% for field in customObject.getCustomFields() %} +
  • +
    +
    +

    + {% set isRequired = field.isRequired() ? true : false %} + {% set requiredTitle = isRequired ? 'mautic.core.required' : 'mautic.core.not_required' %} + {% set requiredClass = isRequired ? 'check' : 'times' %} + + +

    +
    +
    +
    {{ field.getLabel() }}
    +
    +
    + {{ field.getTypeObject().getName() }} +
    +
    +
  • + {% endfor %} +
+
+ +
+
\ No newline at end of file diff --git a/Views/CustomObject/_detail_right_section.html.twig b/Views/CustomObject/_detail_right_section.html.twig new file mode 100644 index 000000000..823880988 --- /dev/null +++ b/Views/CustomObject/_detail_right_section.html.twig @@ -0,0 +1,6 @@ + +
+ + {{ include('MauticCoreBundle:Helper:recentactivity.html.twig', {'logs': logs}) }} +
+ \ No newline at end of file diff --git a/Views/CustomObject/_form-fields.html.php b/Views/CustomObject/_form-fields.html.php deleted file mode 100644 index 8f92e0006..000000000 --- a/Views/CustomObject/_form-fields.html.php +++ /dev/null @@ -1,24 +0,0 @@ -children['customFields']->getIterator() as $customField): - $customFieldEntity = $customField->vars['data']; - if (!in_array($customFieldEntity->getId(), $deletedFields, true)) : - echo $view->render( - "CustomObjectsBundle:CustomObject:Form\\Panel\\{$customFieldEntity->getType()}.html.php", - [ - 'customField' => $customField, - 'customObject' => $customObject, - 'panelId' => $panelId ?? null, - ] - ); - endif; -endforeach; -$form->children['customFields']->setRendered(); diff --git a/Views/CustomObject/_form-fields.html.twig b/Views/CustomObject/_form-fields.html.twig new file mode 100644 index 000000000..55c774387 --- /dev/null +++ b/Views/CustomObject/_form-fields.html.twig @@ -0,0 +1,19 @@ +{% set customFields = form.children['customFields'].getIterator().getArrayCopy() %} + +{% for customField in customFields %} + {% set customFieldEntity = customField.vars.data %} + + {% if customFieldEntity.getId() not in deletedFields %} + {{- include( + 'CustomObjectsBundle:CustomObject:Form\\Panel\\'~customFieldEntity.getType()~'.html.twig', + { + 'customField': customField, + 'customObject': customObject, + 'panelId': panelId ?? null, + + }) + -}} + {% endif %} +{% endfor %} + +{% do form.children['customFields'].setRendered() %} \ No newline at end of file diff --git a/Views/CustomObject/_list.html.twig b/Views/CustomObject/_list.html.twig new file mode 100644 index 000000000..660d06d12 --- /dev/null +++ b/Views/CustomObject/_list.html.twig @@ -0,0 +1,74 @@ +{% set tableAlias = constant('MauticPlugin\\CustomObjectsBundle\\Entity\\CustomObject::TABLE_ALIAS') %} +{% set routeView = constant('MauticPlugin\\CustomObjectsBundle\\Provider\\CustomObjectRouteProvider::ROUTE_VIEW') %} +{% set routeList = constant('MauticPlugin\\CustomObjectsBundle\\Provider\\CustomObjectRouteProvider::ROUTE_LIST') %} + +{% if items|length > 0 %} +
+ + + + {{ include('MauticCoreBundle:Helper:tableheader.html.twig', { + 'checkall': 'true', + 'target': '#custom-objects-table', + 'langVar': 'custom.object', + 'routeBase': 'custom_object', + 'routeBase': 'form' + }) }} + + {{ include('MauticCoreBundle:Helper:tableheader.html.twig', { + 'sessionVar': sessionVar, + 'orderBy': tableAlias~'.namePlural', + 'text': 'mautic.core.name', + 'class': 'col-custom_object_-name' + }) }} + + {{ include('MauticCoreBundle:Helper:tableheader.html.twig', { + 'sessionVar': sessionVar, + 'orderBy': tableAlias~'.id', + 'text': 'mautic.core.id', + 'default': true + }) }} + + + + {% for item in items %} + + + + + + {% endfor %} + +
+ {{- include('MauticCoreBundle:Helper:list_actions.html.twig', { 'item': item }) -}} + +
+ {{- include('MauticCoreBundle:Helper:publishstatus_icon.html.twig', + {'item' : item, 'model' : 'custom.object'}) -}} + + {{ item.name }} + +{# #} +{# {{ item.getName() }}#} +{# #} +
+ {% if item.description %} +
+ {{ item.description|purify }} +
+ {% endif %} +
{{ item.id }}
+
+ +{% else %} + {{ include('MauticCoreBundle:Helper:noresults.html.twig', {'tip': 'custom.object.noresults.tip'}) }} +{% endif %} diff --git a/Views/CustomObject/detail.html.php b/Views/CustomObject/detail.html.php deleted file mode 100644 index f5d9072e4..000000000 --- a/Views/CustomObject/detail.html.php +++ /dev/null @@ -1,149 +0,0 @@ -extend('MauticCoreBundle:Default:content.html.php'); -$view['slots']->set('mauticContent', 'customObject'); -$view['slots']->set('headerTitle', $customObject->getNameSingular()); -$view['slots']->set( - 'actions', - $view->render( - 'MauticCoreBundle:Helper:page_actions.html.php', - ['item' => $customObject] - ) -); - -$view['slots']->set( - 'publishStatus', - $view->render('MauticCoreBundle:Helper:publishstatus_badge.html.php', ['entity' => $customObject]) -); -?> - - -
- -
-
- -
-
-
-
-
-
- - - -
-
-
- - - render( - 'MauticCoreBundle:Helper:details.html.php', - ['entity' => $customObject] -); ?> - -
-
-
-
- -
- - -
- - - - -
-
-
-
-
-
-
- - trans('custom.item.links.in.time'); ?> -
-
-
- render( - 'MauticCoreBundle:Helper:graph_dateselect.html.php', - ['dateRangeForm' => $dateRangeForm, 'class' => 'pull-right'] -); ?> -
-
-
- render( - 'MauticCoreBundle:Helper:chart.html.php', - ['chartData' => $stats, 'chartType' => 'line', 'chartHeight' => 300] -); ?> -
-
-
-
-
- - getCustomContent('details.stats.graph.below', $mauticTemplateVars); ?> - - - - - -
- -
- - -
-
    - getCustomFields() as $field) : ?> -
  • -
    -
    - isRequired() ? 'mautic.core.required' - : 'mautic.core.not_required'; ?> -

    -

    -
    -
    -
    getLabel(); ?>
    -
    -
    - getTypeObject()->getName(); ?> -
    -
    -
  • - -
-
- - -
- -
- - -
- - render('MauticCoreBundle:Helper:recentactivity.html.php', ['logs' => $logs]); ?> -
- -
diff --git a/Views/CustomObject/detail.html.twig b/Views/CustomObject/detail.html.twig new file mode 100644 index 000000000..4bca165f6 --- /dev/null +++ b/Views/CustomObject/detail.html.twig @@ -0,0 +1,27 @@ +{% extends 'MauticCoreBundle:Default:content.html.twig' %} + +{% block mauticContent %}customObject{% endblock %} + +{% block headerTitle %} + {{ customObject.getNameSingular() }} +{% endblock %} + +{% block actions %} + {{ include('MauticCoreBundle:Helper:page_actions.html.twig', { 'item': customObject}) }} +{% endblock %} + +{% block publishStatus %} + {{- include('MauticCoreBundle:Helper:publishstatus_badge.html.twig', {'entity' : customObject}) -}} +{% endblock %} + +{% block content %} +
+ {{ include('CustomObjectsBundle:CustomObject:_detail_left_section.html.twig', { + 'entity': customObject, + 'dateRangeForm': dateRangeForm, + 'chartData': stats, + 'mauticTemplateVars': mauticTemplateVars is defined ? mauticTemplateVars : {} + }) }} + {{ include('CustomObjectsBundle:CustomObject:_detail_right_section.html.twig', {'logs': logs}) }} +
+{% endblock %} \ No newline at end of file diff --git a/Views/CustomObject/form.html.php b/Views/CustomObject/form.html.php deleted file mode 100644 index 09459bb5a..000000000 --- a/Views/CustomObject/form.html.php +++ /dev/null @@ -1,125 +0,0 @@ -extend('MauticCoreBundle:Default:content.html.php'); - -$view['slots']->set('mauticContent', 'customObject'); - -if ($customObject->getId()) { - $header = $view['translator']->trans( - $customObject->getId() ? 'custom.object.edit' : 'custom.object.new', - ['%name%' => $view['translator']->trans($customObject->getName())] - ); -} else { - $header = $view['translator']->trans('custom.object.new'); -} - -$view['slots']->set('headerTitle', $header); -?> - -start($form); ?> - - -
- -
-
-
- - - -
-
-
-
- row($form['nameSingular']); ?> - row($form['namePlural']); ?> - -
-
- row($form['alias']); ?> -
-
-
-
- row($form['description']); ?> -
-
-
- -
- render('MauticFormBundle:Builder:style.html.php'); ?> -
-
-
- -
-
-
- -
- -
-

trans('mautic.form.form.addfield'); ?>

-
- -
-
- -
- -
- -
- -
- -
-
- row($form['type']); ?> - row($form['masterObject']); ?> - row($form['category']); ?> - row($form['isPublished']); ?> -
-
- -
- -end($form); ?> - -append( - 'modal', - $view->render( - 'MauticCoreBundle:Helper:modal.html.php', - [ - 'id' => 'objectFieldModal', - 'header' => false, - 'footerButtons' => true, - ] - ) - ); diff --git a/Views/CustomObject/form.html.twig b/Views/CustomObject/form.html.twig new file mode 100644 index 000000000..235180fad --- /dev/null +++ b/Views/CustomObject/form.html.twig @@ -0,0 +1,98 @@ +{% extends 'MauticCoreBundle:Default:content.html.twig' %} + +{% block mauticContent %}customObject{% endblock %} + +{% block headerTitle %} + {% if customObject.getId() %} + {{ 'custom.object.edit'|trans({'%name%' : customObject.getName()|trans}) }} + {% else %} + {% trans %}custom.object.new{% endtrans %} + {% endif %} +{% endblock %} + +{% block content %} + {{ form_start(form) }} +
+ +
+
+
+ + + +
+
+
+
+ {{ form_row(form.nameSingular) }} + {{ form_row(form.namePlural) }} +
+
+ {{ form_row(form.alias) }} +
+
+
+
+ {{ form_row(form.description) }} +
+
+
+ +
+ {{- include('MauticFormBundle:Builder:_style.html.twig') -}} +
+
+
+ +
+
+
+ {{- include('CustomObjectsBundle:CustomObject:_form-fields.html.twig') -}} +
+ {% if 0 == customFields|length %} +
+

{{ 'mautic.form.form.addfield'|trans }}

+
+ {% endif %} +
+
+
+
+
+
+
+
+ {{ form_row(form.type) }} + {{ form_row(form.masterObject) }} + {{ form_row(form.category) }} + {{ form_row(form.isPublished) }} +
+
+
+ {{ form_end(form) }} +{% endblock %} + +{% block modal %} + {{ include('MauticCoreBundle:Helper:modal.html.twig', { + 'id': 'objectFieldModal', + 'header': false, + 'footerButtons': true, + }) }} +{% endblock %} \ No newline at end of file diff --git a/Views/CustomObject/index.html.php b/Views/CustomObject/index.html.php deleted file mode 100644 index 747f9e08f..000000000 --- a/Views/CustomObject/index.html.php +++ /dev/null @@ -1,21 +0,0 @@ -extend('MauticCoreBundle:Default:content.html.php'); - -$view['slots']->set('mauticContent', 'customObject'); -$view['slots']->set('headerTitle', $view['translator']->trans('custom.object.title')); -$view['slots']->set('actions', $view->render('MauticCoreBundle:Helper:page_actions.html.php')); -?> - -
- render( - 'MauticCoreBundle:Helper:list_toolbar.html.php', - [ - // 'searchValue' => $searchValue, - // 'action' => $currentRoute, - ] -); ?> -
- output('_content'); ?> -
-
diff --git a/Views/CustomObject/list.html.php b/Views/CustomObject/list.html.php deleted file mode 100644 index d493f775b..000000000 --- a/Views/CustomObject/list.html.php +++ /dev/null @@ -1,94 +0,0 @@ -extend('CustomObjectsBundle:CustomObject:index.html.php'); -} -?> - -
- - - - render( - 'MauticCoreBundle:Helper:tableheader.html.php', - [ - 'checkall' => 'true', - 'target' => '#custom-objects-table', - 'langVar' => 'custom.object', - 'routeBase' => 'custom_object', - ] -); - - echo $view->render( - 'MauticCoreBundle:Helper:tableheader.html.php', - [ - 'sessionVar' => $sessionVar, - 'orderBy' => CustomObject::TABLE_ALIAS.'.namePlural', - 'text' => 'mautic.core.name', - 'class' => 'col-custom_object_-name', - ] - ); - - echo $view->render( - 'MauticCoreBundle:Helper:tableheader.html.php', - [ - 'sessionVar' => $sessionVar, - 'orderBy' => CustomObject::TABLE_ALIAS.'.id', - 'text' => 'mautic.core.id', - 'default' => true, - ] - ); - ?> - - - - - - - - - - - -
- render('MauticCoreBundle:Helper:list_actions.html.php', ['item' => $item]); ?> - -
- render( - 'MauticCoreBundle:Helper:publishstatus_icon.html.php', - [ - 'item' => $item, - 'model' => 'custom.object', - ] - ); ?> - - getName(); ?> - -
- getDescription()): ?> -
- getDescription(); ?> -
- -
getId(); ?>
-
- - - render('MauticCoreBundle:Helper:noresults.html.php', ['tip' => 'custom.object.noresults.tip']); ?> - diff --git a/Views/CustomObject/list.html.twig b/Views/CustomObject/list.html.twig new file mode 100644 index 000000000..7b80f7a28 --- /dev/null +++ b/Views/CustomObject/list.html.twig @@ -0,0 +1,27 @@ +{% set isIndex = tmpl == 'index' ? true : false %} +{% set tmpl = 'list' %} + +{% extends isIndex ? 'MauticCoreBundle:Default:content.html.twig' : 'MauticCoreBundle:Default:raw_output.html.twig' %} + +{% block mauticContent %}customObject{% endblock %} + +{% block headerTitle %} + {{ 'custom.object.title'|trans }} +{% endblock %} + +{% block actions %} + {{ include('MauticCoreBundle:Helper:page_actions.html.twig') }} +{% endblock %} + +{% block content %} + {% if isIndex %} +
+ {{ include('MauticCoreBundle:Helper:list_toolbar.html.twig') }} +
+ {{ include('CustomObjectsBundle:CustomObject:_list.html.twig') }} +
+
+ {% else %} + {{ include('CustomObjectsBundle:CustomObject:_list.html.twig') }} + {% endif %} +{% endblock %} \ No newline at end of file diff --git a/Views/FormTheme/FieldValueCondition/campaign_condition_field_value_widget.html.php b/Views/FormTheme/FieldValueCondition/campaign_condition_field_value_widget.html.twig similarity index 100% rename from Views/FormTheme/FieldValueCondition/campaign_condition_field_value_widget.html.php rename to Views/FormTheme/FieldValueCondition/campaign_condition_field_value_widget.html.twig diff --git a/Views/SubscribedEvents/Tab/content.html.php b/Views/SubscribedEvents/Tab/content.html.php deleted file mode 100644 index f4d974389..000000000 --- a/Views/SubscribedEvents/Tab/content.html.php +++ /dev/null @@ -1,50 +0,0 @@ - -
-
-
- render( - 'MauticCoreBundle:Helper:search.html.php', - [ - 'searchValue' => $searchValue, - 'action' => $searchRoute, - 'searchId' => $searchId, - 'target' => '#'.$namespace, - 'searchHelp' => '', - ] -); ?> -
- -
-
- Loading... -
-
- \ No newline at end of file diff --git a/Views/SubscribedEvents/Tab/content.html.twig b/Views/SubscribedEvents/Tab/content.html.twig new file mode 100644 index 000000000..6978d85d0 --- /dev/null +++ b/Views/SubscribedEvents/Tab/content.html.twig @@ -0,0 +1,47 @@ +
+
+
+ {{ include('MauticCoreBundle:Helper:search.html.twig', { + 'searchValue': searchValue, + 'action': searchRoute, + 'searchId': searchId, + 'target': '#'~namespace, + 'searchHelp': '' + }) }} +
+ +
+
+ Loading... +
+
+ + \ No newline at end of file diff --git a/Views/SubscribedEvents/Tab/link.html.php b/Views/SubscribedEvents/Tab/link.html.php deleted file mode 100644 index a3ca11442..000000000 --- a/Views/SubscribedEvents/Tab/link.html.php +++ /dev/null @@ -1,15 +0,0 @@ - -
  • - - - - - - - escape($view['translator']->trans($title)); ?> - -
  • \ No newline at end of file diff --git a/Views/SubscribedEvents/Tab/link.html.twig b/Views/SubscribedEvents/Tab/link.html.twig new file mode 100644 index 000000000..304c26ac0 --- /dev/null +++ b/Views/SubscribedEvents/Tab/link.html.twig @@ -0,0 +1,11 @@ +
  • + + {% if count is defined %} + + {{ count }} + + {% endif %} + + {{ title|trans }} + +
  • \ No newline at end of file diff --git a/Views/SubscribedEvents/Tab/modal.html.php b/Views/SubscribedEvents/Tab/modal.html.php deleted file mode 100644 index cb1261e42..000000000 --- a/Views/SubscribedEvents/Tab/modal.html.php +++ /dev/null @@ -1,8 +0,0 @@ -append('modal', $view->render('MauticCoreBundle:Helper:modal.html.php', [ - 'id' => 'customItemLookupModal', - 'size' => 'xl', -])); diff --git a/Views/SubscribedEvents/Tab/modal.html.twig b/Views/SubscribedEvents/Tab/modal.html.twig new file mode 100644 index 000000000..b91a28994 --- /dev/null +++ b/Views/SubscribedEvents/Tab/modal.html.twig @@ -0,0 +1,6 @@ +{% block modal %} + {{ include('MauticCoreBundle:Helper:modal.html.twig', { + 'id': 'customItemLookupModal', + 'size': xl + }) }} +{% endblock %} \ No newline at end of file diff --git a/Views/SubscribedEvents/Timeline/link.html.php b/Views/SubscribedEvents/Timeline/link.html.php deleted file mode 100644 index 89cfec02f..000000000 --- a/Views/SubscribedEvents/Timeline/link.html.php +++ /dev/null @@ -1,17 +0,0 @@ - -
    - -
    - trans('mautic.core.createdby'); ?> -
    -
    - - - -
    - -
    diff --git a/Views/SubscribedEvents/Timeline/link.html.twig b/Views/SubscribedEvents/Timeline/link.html.twig new file mode 100644 index 000000000..36efb8b5b --- /dev/null +++ b/Views/SubscribedEvents/Timeline/link.html.twig @@ -0,0 +1,12 @@ +{% set link = event.extra %} + +
    + {% if link.user_id is not empty %} +
    {{ 'mautic.core.createdby'|trans }}
    +
    + + {{ link.user_name }} + +
    + {% endif %} +
    From e88f11b4423e39b59d96f88cf215a9507bfa15ea Mon Sep 17 00:00:00 2001 From: Volha Pivavarchyk Date: Tue, 7 Mar 2023 21:07:41 +0300 Subject: [PATCH 2/9] use correct links in the custom items list --- Views/CustomItem/_list.html.twig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Views/CustomItem/_list.html.twig b/Views/CustomItem/_list.html.twig index d0f2da4c4..f46cc8c02 100644 --- a/Views/CustomItem/_list.html.twig +++ b/Views/CustomItem/_list.html.twig @@ -1,6 +1,6 @@ -{% set tableAlias = constant('MauticPlugin\\CustomObjectsBundle\\Entity\\CustomObject::TABLE_ALIAS') %} -{% set routeView = constant('MauticPlugin\\CustomObjectsBundle\\Provider\\CustomObjectRouteProvider::ROUTE_VIEW') %} -{% set routeList = constant('MauticPlugin\\CustomObjectsBundle\\Provider\\CustomObjectRouteProvider::ROUTE_LIST') %} +{% set tableAlias = constant('MauticPlugin\\CustomObjectsBundle\\Entity\\CustomItem::TABLE_ALIAS') %} +{% set routeView = constant('MauticPlugin\\CustomObjectsBundle\\Provider\\CustomItemRouteProvider::ROUTE_VIEW') %} +{% set routeList = constant('MauticPlugin\\CustomObjectsBundle\\Provider\\CustomItemRouteProvider::ROUTE_LIST') %} {% set routerSelf = path(routeList, { 'objectId': customObject.getId(), From 63b636fc786bdae5c485023ade77355dd76b0f41 Mon Sep 17 00:00:00 2001 From: Volha Pivavarchyk Date: Wed, 17 May 2023 00:35:07 +0300 Subject: [PATCH 3/9] remove deprecated dependecies --- Command/CustomItemsScheduledExportCommand.php | 2 +- Config/config.php | 2 +- EventListener/AssetsSubscriber.php | 2 +- Model/CustomItemImportModel.php | 2 +- Tests/Unit/EventListener/AssetsSubscriberTest.php | 2 +- Tests/Unit/Model/CustomItemImportModelTest.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Command/CustomItemsScheduledExportCommand.php b/Command/CustomItemsScheduledExportCommand.php index 74e4e74a5..b7f21593a 100644 --- a/Command/CustomItemsScheduledExportCommand.php +++ b/Command/CustomItemsScheduledExportCommand.php @@ -5,7 +5,7 @@ namespace MauticPlugin\CustomObjectsBundle\Command; use Mautic\CoreBundle\Helper\ExitCode; -use Mautic\CoreBundle\Templating\Helper\FormatterHelper; +use Mautic\CoreBundle\Twig\Helper\FormatterHelper; use MauticPlugin\CustomObjectsBundle\CustomItemEvents; use MauticPlugin\CustomObjectsBundle\Event\CustomItemExportSchedulerEvent; use MauticPlugin\CustomObjectsBundle\Model\CustomItemExportSchedulerModel; diff --git a/Config/config.php b/Config/config.php index 1476deaf4..00c99c2a8 100644 --- a/Config/config.php +++ b/Config/config.php @@ -540,7 +540,7 @@ 'arguments' => [ 'doctrine.orm.entity_manager', 'mautic.custom.model.item', - 'mautic.helper.template.formatter', + 'mautic.helper.twig.formatter', ], ], 'mautic.custom.model.import.xref.contact' => [ diff --git a/EventListener/AssetsSubscriber.php b/EventListener/AssetsSubscriber.php index 997431a27..c040b8b47 100644 --- a/EventListener/AssetsSubscriber.php +++ b/EventListener/AssetsSubscriber.php @@ -4,7 +4,7 @@ namespace MauticPlugin\CustomObjectsBundle\EventListener; -use Mautic\CoreBundle\Templating\Helper\AssetsHelper; +use Mautic\CoreBundle\Twig\Helper\AssetsHelper; use MauticPlugin\CustomObjectsBundle\Provider\ConfigProvider; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/Model/CustomItemImportModel.php b/Model/CustomItemImportModel.php index 64d1d6266..23846d9fc 100644 --- a/Model/CustomItemImportModel.php +++ b/Model/CustomItemImportModel.php @@ -6,7 +6,7 @@ use Doctrine\ORM\EntityManager; use Mautic\CoreBundle\Model\FormModel; -use Mautic\CoreBundle\Templating\Helper\FormatterHelper; +use Mautic\CoreBundle\Twig\Helper\FormatterHelper; use Mautic\LeadBundle\Entity\Import; use Mautic\UserBundle\Entity\User; use MauticPlugin\CustomObjectsBundle\Entity\CustomItem; diff --git a/Tests/Unit/EventListener/AssetsSubscriberTest.php b/Tests/Unit/EventListener/AssetsSubscriberTest.php index ec20fc3c9..b52635963 100644 --- a/Tests/Unit/EventListener/AssetsSubscriberTest.php +++ b/Tests/Unit/EventListener/AssetsSubscriberTest.php @@ -4,7 +4,7 @@ namespace MauticPlugin\CustomObjectsBundle\Tests\Unit\EventListener; -use Mautic\CoreBundle\Templating\Helper\AssetsHelper; +use Mautic\CoreBundle\Twig\Helper\AssetsHelper; use MauticPlugin\CustomObjectsBundle\EventListener\AssetsSubscriber; use MauticPlugin\CustomObjectsBundle\Provider\ConfigProvider; use Symfony\Component\HttpFoundation\Request; diff --git a/Tests/Unit/Model/CustomItemImportModelTest.php b/Tests/Unit/Model/CustomItemImportModelTest.php index 17aca122e..0d00c03c0 100644 --- a/Tests/Unit/Model/CustomItemImportModelTest.php +++ b/Tests/Unit/Model/CustomItemImportModelTest.php @@ -6,7 +6,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\EntityManager; -use Mautic\CoreBundle\Templating\Helper\FormatterHelper; +use Mautic\CoreBundle\Twig\Helper\FormatterHelper; use Mautic\LeadBundle\Entity\Import; use Mautic\LeadBundle\Provider\FilterOperatorProviderInterface; use Mautic\UserBundle\Entity\User; From 3224ef478af1e3d36eeae48855e4afc050978ad0 Mon Sep 17 00:00:00 2001 From: Volha Pivavarchyk Date: Wed, 17 May 2023 00:47:08 +0300 Subject: [PATCH 4/9] change style of links to twig patterns --- Controller/CustomField/FormController.php | 2 +- Controller/CustomField/SaveController.php | 4 ++-- Controller/CustomItem/FormController.php | 2 +- Controller/CustomItem/LinkFormController.php | 4 ++-- Controller/CustomItem/SaveController.php | 2 +- Controller/CustomItem/ViewController.php | 2 +- Controller/CustomObject/FormController.php | 2 +- Controller/CustomObject/ListController.php | 2 +- Controller/CustomObject/SaveController.php | 2 +- Controller/CustomObject/ViewController.php | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Controller/CustomField/FormController.php b/Controller/CustomField/FormController.php index eaeacd1c5..2308a3656 100644 --- a/Controller/CustomField/FormController.php +++ b/Controller/CustomField/FormController.php @@ -114,7 +114,7 @@ public function renderFormAction(Request $request): Response 'customField' => $customField, 'form' => $form->createView(), ], - 'contentTemplate' => 'CustomObjectsBundle:CustomField:form.html.twig', + 'contentTemplate' => '@CustomObjects/CustomField/form.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customField', 'route' => $route, diff --git a/Controller/CustomField/SaveController.php b/Controller/CustomField/SaveController.php index 49ee80ca7..dea0d5b33 100644 --- a/Controller/CustomField/SaveController.php +++ b/Controller/CustomField/SaveController.php @@ -134,7 +134,7 @@ public function saveAction(Request $request) 'customField' => $customField, 'form' => $form->createView(), ], - 'contentTemplate' => 'CustomObjectsBundle:CustomField:form.html.twig', + 'contentTemplate' => '@CustomObjects/CustomField/form.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customField', 'route' => $route, @@ -178,7 +178,7 @@ private function buildSuccessForm(CustomObject $customObject, CustomField $custo ); $template = $this->render( - 'CustomObjectsBundle:CustomObject:_form-fields.html.twig', + '@CustomObjects/CustomObject/_form-fields.html.twig', [ 'form' => $form->createView(), 'panelId' => $panelId, // Panel id to me replaced if edit diff --git a/Controller/CustomItem/FormController.php b/Controller/CustomItem/FormController.php index e1adbfc0f..e8c7d8932 100644 --- a/Controller/CustomItem/FormController.php +++ b/Controller/CustomItem/FormController.php @@ -214,7 +214,7 @@ private function renderFormForItem(CustomItem $customItem, string $route, ?int $ 'customObject' => $customItem->getCustomObject(), 'form' => $form->createView(), ], - 'contentTemplate' => 'CustomObjectsBundle:CustomItem:form.html.twig', + 'contentTemplate' => '@CustomObjects/CustomItem/form.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customItem', 'route' => $route, diff --git a/Controller/CustomItem/LinkFormController.php b/Controller/CustomItem/LinkFormController.php index cc2076b47..f3b0e9f67 100644 --- a/Controller/CustomItem/LinkFormController.php +++ b/Controller/CustomItem/LinkFormController.php @@ -95,7 +95,7 @@ public function formAction(int $itemId, string $entityType, int $entityId): Resp 'customObject' => $relationshipObject, 'form' => $form->createView(), ], - 'contentTemplate' => 'CustomObjectsBundle:CustomItem:form.html.twig', + 'contentTemplate' => '@CustomObjects/CustomItem/form.html.twig', 'passthroughVars' => [ 'callback' => 'customItemLinkFormLoad', 'mauticContent' => 'customItem', @@ -170,7 +170,7 @@ public function saveAction(int $itemId, string $entityType, int $entityId): Resp 'form' => $form->createView(), 'tmpl' => $this->request->isXmlHttpRequest() ? $this->request->get('tmpl', 'index') : 'index', ], - 'contentTemplate' => 'CustomObjectsBundle:CustomItem:form.html.twig', + 'contentTemplate' => '@CustomObjects/CustomItem/form.html.twig', 'passthroughVars' => [ 'closeModal' => false, 'callback' => 'customItemLinkFormLoad', diff --git a/Controller/CustomItem/SaveController.php b/Controller/CustomItem/SaveController.php index 577db435b..c00048b61 100644 --- a/Controller/CustomItem/SaveController.php +++ b/Controller/CustomItem/SaveController.php @@ -203,7 +203,7 @@ public function saveAction(int $objectId, ?int $itemId = null): Response 'form' => $form->createView(), 'tmpl' => $request->isXmlHttpRequest() ? $request->get('tmpl', 'index') : 'index', ], - 'contentTemplate' => 'CustomObjectsBundle:CustomItem:form.html.twig', + 'contentTemplate' => '@CustomObjects/CustomItem/form.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customItem', 'route' => $route, diff --git a/Controller/CustomItem/ViewController.php b/Controller/CustomItem/ViewController.php index 1386cd811..5f590e88f 100644 --- a/Controller/CustomItem/ViewController.php +++ b/Controller/CustomItem/ViewController.php @@ -114,7 +114,7 @@ public function viewAction(int $objectId, int $itemId): Response ] )->getContent(), ], - 'contentTemplate' => 'CustomObjectsBundle:CustomItem:detail.html.twig', + 'contentTemplate' => '@CustomObjects/CustomItem/detail.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customItem', 'activeLink' => "#mautic_custom_object_{$objectId}", diff --git a/Controller/CustomObject/FormController.php b/Controller/CustomObject/FormController.php index 20e2229f1..8009998a3 100644 --- a/Controller/CustomObject/FormController.php +++ b/Controller/CustomObject/FormController.php @@ -144,7 +144,7 @@ private function renderForm(CustomObject $customObject, string $route): Response 'deletedFields' => [], 'form' => $form->createView(), ], - 'contentTemplate' => 'CustomObjectsBundle:CustomObject:form.html.twig', + 'contentTemplate' => '@CustomObjects/CustomObject/form.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customObject', 'route' => $route, diff --git a/Controller/CustomObject/ListController.php b/Controller/CustomObject/ListController.php index a3d26e350..76149bc5f 100644 --- a/Controller/CustomObject/ListController.php +++ b/Controller/CustomObject/ListController.php @@ -98,7 +98,7 @@ public function listAction(int $page = 1): Response 'tmpl' => $request->isXmlHttpRequest() ? $request->get('tmpl', 'index') : 'index', 'sessionVar' => $sessionProvider->getNamespace(), ], - 'contentTemplate' => 'CustomObjectsBundle:CustomObject:list.html.twig', + 'contentTemplate' => '@CustomObjects/CustomObject/list.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customObject', 'route' => $route, diff --git a/Controller/CustomObject/SaveController.php b/Controller/CustomObject/SaveController.php index e521a3385..2bf9c008c 100644 --- a/Controller/CustomObject/SaveController.php +++ b/Controller/CustomObject/SaveController.php @@ -180,7 +180,7 @@ public function saveAction(?int $objectId = null): Response 'deletedFields' => [], 'form' => $form->createView(), ], - 'contentTemplate' => 'CustomObjectsBundle:CustomObject:form.html.twig', + 'contentTemplate' => '@CustomObjects/CustomObject/form.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customObject', 'route' => $objectId ? $this->routeProvider->buildEditRoute($customObject->getId()) : $this->routeProvider->buildNewRoute(), diff --git a/Controller/CustomObject/ViewController.php b/Controller/CustomObject/ViewController.php index 15d4ddda7..dbd260ded 100644 --- a/Controller/CustomObject/ViewController.php +++ b/Controller/CustomObject/ViewController.php @@ -104,7 +104,7 @@ public function viewAction(int $objectId): Response 'stats' => $stats, 'logs' => $auditLogs, ], - 'contentTemplate' => 'CustomObjectsBundle:CustomObject:detail.html.twig', + 'contentTemplate' => '@CustomObjects/CustomObject/detail.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customObject', 'activeLink' => "#mautic_custom_object_{$objectId}", From bebef1900b544a74b0089322308692429ba57411 Mon Sep 17 00:00:00 2001 From: Volha Pivavarchyk Date: Wed, 17 May 2023 01:03:01 +0300 Subject: [PATCH 5/9] adjust twig templates to a new structure --- .../_detail_left_section.html.twig | 2 +- .../_detail_right_section.html.twig | 2 +- Resources/views/CustomField/detail.html.twig | 19 +++++++++++++ .../views}/CustomField/form.html.twig | 4 +-- .../views}/CustomField/value.html.twig | 2 +- .../CustomItem/_detail_left_section.html.twig | 16 +++++------ .../_detail_right_section.html.twig | 2 +- .../views}/CustomItem/_list.html.twig | 18 ++++++------- .../views}/CustomItem/detail.html.twig | 10 +++---- .../views}/CustomItem/form.html.twig | 7 ++--- .../views}/CustomItem/list.html.twig | 10 +++---- .../CustomObject/Form/Panel/_field.html.twig | 0 .../Form/Panel/checkbox_group.html.twig | 1 + .../CustomObject/Form/Panel/country.html.twig | 1 + .../CustomObject/Form/Panel/date.html.twig | 1 + .../Form/Panel/datetime.html.twig | 1 + .../CustomObject/Form/Panel/email.html.twig | 1 + .../CustomObject/Form/Panel/hidden.html.twig | 1 + .../Form/Panel/html_area.html.twig | 1 + .../CustomObject/Form/Panel/int.html.twig | 1 + .../Form/Panel/multiselect.html.twig | 1 + .../CustomObject/Form/Panel/phone.html.twig | 1 + .../Form/Panel/radio_group.html.twig | 1 + .../CustomObject/Form/Panel/select.html.twig | 1 + .../CustomObject/Form/Panel/text.html.twig | 1 + .../Form/Panel/textarea.html.twig | 1 + .../CustomObject/Form/Panel/url.html.twig | 1 + .../_detail_left_section.html.twig | 6 ++--- .../_detail_right_section.html.twig | 2 +- .../CustomObject/_form-fields.html.twig | 2 +- .../views}/CustomObject/_list.html.twig | 14 +++++----- .../views}/CustomObject/detail.html.twig | 10 +++---- .../views}/CustomObject/form.html.twig | 8 +++--- Resources/views/CustomObject/list.html.twig | 27 +++++++++++++++++++ ...ign_condition_field_value_widget.html.twig | 6 ++--- .../SubscribedEvents/Tab/content.html.twig | 14 +++++----- .../SubscribedEvents/Tab/link.html.twig | 0 .../SubscribedEvents/Tab/modal.html.twig | 4 +-- .../SubscribedEvents/Timeline/link.html.twig | 0 Views/CustomField/detail.html.twig | 19 ------------- .../Form/Panel/checkbox_group.html.twig | 1 - .../CustomObject/Form/Panel/country.html.twig | 1 - Views/CustomObject/Form/Panel/date.html.twig | 1 - .../Form/Panel/datetime.html.twig | 1 - Views/CustomObject/Form/Panel/email.html.twig | 1 - .../CustomObject/Form/Panel/hidden.html.twig | 1 - .../Form/Panel/html_area.html.twig | 1 - Views/CustomObject/Form/Panel/int.html.twig | 1 - .../Form/Panel/multiselect.html.twig | 1 - Views/CustomObject/Form/Panel/phone.html.twig | 1 - .../Form/Panel/radio_group.html.twig | 1 - .../CustomObject/Form/Panel/select.html.twig | 1 - Views/CustomObject/Form/Panel/text.html.twig | 1 - .../Form/Panel/textarea.html.twig | 1 - Views/CustomObject/Form/Panel/url.html.twig | 1 - Views/CustomObject/list.html.twig | 27 ------------------- 56 files changed, 132 insertions(+), 129 deletions(-) rename {Views => Resources/views}/CustomField/_detail_left_section.html.twig (88%) rename {Views => Resources/views}/CustomField/_detail_right_section.html.twig (89%) create mode 100644 Resources/views/CustomField/detail.html.twig rename {Views => Resources/views}/CustomField/form.html.twig (96%) rename {Views => Resources/views}/CustomField/value.html.twig (87%) rename {Views => Resources/views}/CustomItem/_detail_left_section.html.twig (84%) rename {Views => Resources/views}/CustomItem/_detail_right_section.html.twig (60%) rename {Views => Resources/views}/CustomItem/_list.html.twig (79%) rename {Views => Resources/views}/CustomItem/detail.html.twig (52%) rename {Views => Resources/views}/CustomItem/form.html.twig (87%) rename {Views => Resources/views}/CustomItem/list.html.twig (66%) rename {Views => Resources/views}/CustomObject/Form/Panel/_field.html.twig (100%) create mode 100644 Resources/views/CustomObject/Form/Panel/checkbox_group.html.twig create mode 100644 Resources/views/CustomObject/Form/Panel/country.html.twig create mode 100644 Resources/views/CustomObject/Form/Panel/date.html.twig create mode 100644 Resources/views/CustomObject/Form/Panel/datetime.html.twig create mode 100644 Resources/views/CustomObject/Form/Panel/email.html.twig create mode 100644 Resources/views/CustomObject/Form/Panel/hidden.html.twig create mode 100644 Resources/views/CustomObject/Form/Panel/html_area.html.twig create mode 100644 Resources/views/CustomObject/Form/Panel/int.html.twig create mode 100644 Resources/views/CustomObject/Form/Panel/multiselect.html.twig create mode 100644 Resources/views/CustomObject/Form/Panel/phone.html.twig create mode 100644 Resources/views/CustomObject/Form/Panel/radio_group.html.twig create mode 100644 Resources/views/CustomObject/Form/Panel/select.html.twig create mode 100644 Resources/views/CustomObject/Form/Panel/text.html.twig create mode 100644 Resources/views/CustomObject/Form/Panel/textarea.html.twig create mode 100644 Resources/views/CustomObject/Form/Panel/url.html.twig rename {Views => Resources/views}/CustomObject/_detail_left_section.html.twig (91%) rename {Views => Resources/views}/CustomObject/_detail_right_section.html.twig (60%) rename {Views => Resources/views}/CustomObject/_form-fields.html.twig (83%) rename {Views => Resources/views}/CustomObject/_list.html.twig (81%) rename {Views => Resources/views}/CustomObject/detail.html.twig (52%) rename {Views => Resources/views}/CustomObject/form.html.twig (93%) create mode 100644 Resources/views/CustomObject/list.html.twig rename {Views => Resources/views}/FormTheme/FieldValueCondition/campaign_condition_field_value_widget.html.twig (56%) rename {Views => Resources/views}/SubscribedEvents/Tab/content.html.twig (78%) rename {Views => Resources/views}/SubscribedEvents/Tab/link.html.twig (100%) rename {Views => Resources/views}/SubscribedEvents/Tab/modal.html.twig (50%) rename {Views => Resources/views}/SubscribedEvents/Timeline/link.html.twig (100%) delete mode 100644 Views/CustomField/detail.html.twig delete mode 100644 Views/CustomObject/Form/Panel/checkbox_group.html.twig delete mode 100644 Views/CustomObject/Form/Panel/country.html.twig delete mode 100644 Views/CustomObject/Form/Panel/date.html.twig delete mode 100644 Views/CustomObject/Form/Panel/datetime.html.twig delete mode 100644 Views/CustomObject/Form/Panel/email.html.twig delete mode 100644 Views/CustomObject/Form/Panel/hidden.html.twig delete mode 100644 Views/CustomObject/Form/Panel/html_area.html.twig delete mode 100644 Views/CustomObject/Form/Panel/int.html.twig delete mode 100644 Views/CustomObject/Form/Panel/multiselect.html.twig delete mode 100644 Views/CustomObject/Form/Panel/phone.html.twig delete mode 100644 Views/CustomObject/Form/Panel/radio_group.html.twig delete mode 100644 Views/CustomObject/Form/Panel/select.html.twig delete mode 100644 Views/CustomObject/Form/Panel/text.html.twig delete mode 100644 Views/CustomObject/Form/Panel/textarea.html.twig delete mode 100644 Views/CustomObject/Form/Panel/url.html.twig delete mode 100644 Views/CustomObject/list.html.twig diff --git a/Views/CustomField/_detail_left_section.html.twig b/Resources/views/CustomField/_detail_left_section.html.twig similarity index 88% rename from Views/CustomField/_detail_left_section.html.twig rename to Resources/views/CustomField/_detail_left_section.html.twig index 9b818961f..9908463b5 100644 --- a/Views/CustomField/_detail_left_section.html.twig +++ b/Resources/views/CustomField/_detail_left_section.html.twig @@ -8,7 +8,7 @@
    {{ item.type }}
    - {{ include('MauticCoreBundle:Helper:publishstatus_badge.html.twig', { + {{ include('@MauticCore/Helper/publishstatus_badge.html.twig', { entity: item }) }}
    diff --git a/Views/CustomField/_detail_right_section.html.twig b/Resources/views/CustomField/_detail_right_section.html.twig similarity index 89% rename from Views/CustomField/_detail_right_section.html.twig rename to Resources/views/CustomField/_detail_right_section.html.twig index 0106b5102..8eedccc78 100644 --- a/Views/CustomField/_detail_right_section.html.twig +++ b/Resources/views/CustomField/_detail_right_section.html.twig @@ -14,7 +14,7 @@
    - {{ include('MauticCoreBundle:Helper:recentactivity.html.twig', { + {{ include('@MauticCore/Helper/recentactivity.html.twig', { logs: logs }) }} diff --git a/Resources/views/CustomField/detail.html.twig b/Resources/views/CustomField/detail.html.twig new file mode 100644 index 000000000..ec6a6e8bc --- /dev/null +++ b/Resources/views/CustomField/detail.html.twig @@ -0,0 +1,19 @@ +{% extends '@MauticCore/Default/content.html.twig.html.twig' %} + +{% block mauticContent %}customField{% endblock %} + +{% block headerTitle %} + {{ item.getName() }} +{% endblock %} + +{% block actions %} + {{ include('@MauticCore/Helper/page_actions.html.twig', { 'item': item }) }} +{% endblock %} + +{% block content %} + +
    + {{ include('@CustomObjects/CustomField/_detail_left_section.html.twig') }} + {{ include('@CustomObjects/CustomField/_detail_right_section.html.twig', {'logs': logs}) }} +
    +{% endblock %} \ No newline at end of file diff --git a/Views/CustomField/form.html.twig b/Resources/views/CustomField/form.html.twig similarity index 96% rename from Views/CustomField/form.html.twig rename to Resources/views/CustomField/form.html.twig index a8e398dfc..dd1d6ed5d 100644 --- a/Views/CustomField/form.html.twig +++ b/Resources/views/CustomField/form.html.twig @@ -1,5 +1,5 @@ {% set title = customField.id ? customField.label : customField.typeObject.name %} -{% set showProperties = form.options or customField.typeObject.placeholder %} +{% set showProperties = form.options is defined or customField.typeObject.usePlaceholder() %} {% block content %}
    @@ -34,7 +34,7 @@
    - {{ form_label(form, label) }} + {{ form_row(form.label) }}
    {{ form_row(form.showInCustomObjectDetailList) }} diff --git a/Views/CustomField/value.html.twig b/Resources/views/CustomField/value.html.twig similarity index 87% rename from Views/CustomField/value.html.twig rename to Resources/views/CustomField/value.html.twig index d719533d2..96cf70070 100644 --- a/Views/CustomField/value.html.twig +++ b/Resources/views/CustomField/value.html.twig @@ -6,7 +6,7 @@ {{ date }} {% elseif customFieldType in fieldTypes %} {# TODO: Transform to string #} - {{ '%s'|format(fieldValue|escape)|raw }} + {{ '%s'|format(fieldValue.getCustomField().getTypeObject()|escape)|raw }} {% elseif fieldValue.getValue() is iterable %} {{ fieldValue.getValue()|join(', ') }} {% else %} diff --git a/Views/CustomItem/_detail_left_section.html.twig b/Resources/views/CustomItem/_detail_left_section.html.twig similarity index 84% rename from Views/CustomItem/_detail_left_section.html.twig rename to Resources/views/CustomItem/_detail_left_section.html.twig index 95edd0d9b..9c2f91c86 100644 --- a/Views/CustomItem/_detail_left_section.html.twig +++ b/Resources/views/CustomItem/_detail_left_section.html.twig @@ -12,7 +12,7 @@
    {# TODO: Check if this block is needed #}
    - {{ include('MauticCoreBundle:Helper:publishstatus_badge.html.twig', { + {{ include('@MauticCore/Helper/publishstatus_badge.html.twig', { entity: item }) }}
    @@ -24,14 +24,14 @@
    - {{ include('MauticCoreBundle:Helper:details.html.twig', { + {{ include('@MauticCore/Helper/details.html.twig', { entity: item }) }} {% for fieldValue in item.getCustomFieldValues() %} @@ -70,14 +70,14 @@
    - {{ include('MauticCoreBundle:Helper:graph_dateselect.html.twig', { + {{ include('@MauticCore/Helper/graph_dateselect.html.twig', { dateRangeForm: dateRangeForm, class: 'pull-right' }) }}
    - {{ include('MauticCoreBundle:Helper:chart.html.twig', { + {{ include('@MauticCore/Helper/chart.html.twig', { chartData: stats, chartType: 'line', chartHeight: 300 @@ -97,16 +97,16 @@ {{ 'mautic.lead.leads'|trans }} - {{ customContent('tabs', mauticTemplateVars is defined ? mauticTemplateVars : []) }} + {{ customContent('tabs', mauticTemplateVars|default({'mauticTemplate': '@CustomObjects/CustomItem/detail.html.twig', 'item': item})) }}
    - + {{ contacts|raw }}
    - {{ customContent('tabs.content', mauticTemplateVars is defined ? mauticTemplateVars : []) }} + {{ customContent('tabs.content', mauticTemplateVars|default({'mauticTemplate': '@CustomObjects/CustomItem/detail.html.twig', 'item': item})) }}
    \ No newline at end of file diff --git a/Views/CustomItem/_detail_right_section.html.twig b/Resources/views/CustomItem/_detail_right_section.html.twig similarity index 60% rename from Views/CustomItem/_detail_right_section.html.twig rename to Resources/views/CustomItem/_detail_right_section.html.twig index 823880988..02d22b0ba 100644 --- a/Views/CustomItem/_detail_right_section.html.twig +++ b/Resources/views/CustomItem/_detail_right_section.html.twig @@ -1,6 +1,6 @@
    - {{ include('MauticCoreBundle:Helper:recentactivity.html.twig', {'logs': logs}) }} + {{ include('@MauticCore/Helper/recentactivity.html.twig', {'logs': logs}) }}
    \ No newline at end of file diff --git a/Views/CustomItem/_list.html.twig b/Resources/views/CustomItem/_list.html.twig similarity index 79% rename from Views/CustomItem/_list.html.twig rename to Resources/views/CustomItem/_list.html.twig index f46cc8c02..34f36f3f3 100644 --- a/Views/CustomItem/_list.html.twig +++ b/Resources/views/CustomItem/_list.html.twig @@ -15,14 +15,14 @@
    {{ '%s'|format(fieldValue.getCustomField().getName()|escape)|raw }} - {{ include('CustomObjectsBundle:CustomField:value.html.twig', { + {{ include('@CustomObjects/CustomField/value.html.twig', { fieldValue: fieldValue }) }}
    - {{- include('MauticCoreBundle:Helper:tableheader.html.twig', { + {{- include('@MauticCore/Helper/tableheader.html.twig', { 'checkall' : 'true', 'target' : target, 'langVar' : 'custom.item', 'routeBase' : 'custom_item', 'baseUrl' : routerSelf }) -}} - {{- include('MauticCoreBundle:Helper:tableheader.html.twig', { + {{- include('@MauticCore/Helper/tableheader.html.twig', { 'sessionVar' : sessionVar, 'orderBy' : tableAlias~'.name', 'text' : 'mautic.core.name', @@ -30,7 +30,7 @@ 'baseUrl' : routerSelf, 'target' : target }) -}} - {{- include('MauticCoreBundle:Helper:tableheader.html.twig', { + {{- include('@MauticCore/Helper/tableheader.html.twig', { 'sessionVar' : sessionVar, 'orderBy' : tableAlias~'.id', 'text' : 'mautic.core.id', @@ -41,7 +41,7 @@ {% if fieldData is not empty %} {% for columnLabel in fieldData.getColumnLabels() %} - {{- include('MauticCoreBundle:Helper:tableheader.html.twig', { 'text' : columnLabel }) -}} + {{- include('@MauticCore/Helper/tableheader.html.twig', { 'text' : columnLabel }) -}} {% endfor %} {% endif %} @@ -50,11 +50,11 @@ {% for item in items %} {% endfor %} {% endif %} @@ -78,7 +78,7 @@ {% else %} - {{- include('MauticCoreBundle:Helper:noresults.html.twig', { 'tip' : lookup ? 'custom.item.link.noresults.tip' : 'custom.object.noresults.tip' }) -}} + {{- include('@MauticCore/Helper/noresults.html.twig', { 'tip' : lookup ? 'custom.item.link.noresults.tip' : 'custom.object.noresults.tip' }) -}} {% endif %} diff --git a/Views/CustomItem/detail.html.twig b/Resources/views/CustomItem/detail.html.twig similarity index 52% rename from Views/CustomItem/detail.html.twig rename to Resources/views/CustomItem/detail.html.twig index 92051b187..dc1910a28 100644 --- a/Views/CustomItem/detail.html.twig +++ b/Resources/views/CustomItem/detail.html.twig @@ -1,4 +1,4 @@ -{% extends 'MauticCoreBundle:Default:content.html.twig' %} +{% extends '@MauticCore/Default/content.html.twig' %} {% block mauticContent %}customItem{% endblock %} @@ -7,21 +7,21 @@ {% endblock %} {% block actions %} - {{ include('MauticCoreBundle:Helper:page_actions.html.twig', { 'item': item }) }} + {{ include('@MauticCore/Helper/page_actions.html.twig', { 'item': item }) }} {% endblock %} {% block publishStatus %} - {{- include('MauticCoreBundle:Helper:publishstatus_badge.html.twig', {'entity' : item}) -}} + {{- include('@MauticCore/Helper/publishstatus_badge.html.twig', {'entity' : item}) -}} {% endblock %} {% block content %}
    - {{ include('CustomObjectsBundle:CustomItem:_detail_left_section.html.twig', { + {{ include('@CustomObjects/CustomItem/_detail_left_section.html.twig', { 'entity': item, 'dateRangeForm': dateRangeForm, 'chartData': stats, 'mauticTemplateVars': mauticTemplateVars is defined ? mauticTemplateVars : {} }) }} - {{ include('CustomObjectsBundle:CustomItem:_detail_right_section.html.twig', {'logs': logs}) }} + {{ include('@CustomObjects/CustomItem/_detail_right_section.html.twig', {'logs': logs}) }}
    {% endblock %} diff --git a/Views/CustomItem/form.html.twig b/Resources/views/CustomItem/form.html.twig similarity index 87% rename from Views/CustomItem/form.html.twig rename to Resources/views/CustomItem/form.html.twig index 822c1fccf..c23ff9e88 100644 --- a/Views/CustomItem/form.html.twig +++ b/Resources/views/CustomItem/form.html.twig @@ -1,4 +1,4 @@ -{% extends 'MauticCoreBundle:Default:content.html.twig' %} +{% extends '@MauticCore/Default/content.html.twig' %} {% block mauticContent %}customItem{% endblock %} @@ -27,7 +27,7 @@ {{ form_row(form.custom_field_values) }} {{ form_row(form.contact_id) }} - {% if customObject.getRelationshipObject() is not empty and form.contact_id.value is not empty %} + {% if customObject.getRelationshipObject() is not empty and form.contact_id.vars.value is not empty %}
    @@ -36,7 +36,8 @@
    - {{ formRowIfExists(fields, 'child_custom_field_values', template) }} + {{ form_row(fields, 'child_custom_field_values', template) }} +{# {{ formRowIfExists(fields, 'child_custom_field_values', template) }}#}
    diff --git a/Views/CustomItem/list.html.twig b/Resources/views/CustomItem/list.html.twig similarity index 66% rename from Views/CustomItem/list.html.twig rename to Resources/views/CustomItem/list.html.twig index 8d3e36bfd..88711f763 100644 --- a/Views/CustomItem/list.html.twig +++ b/Resources/views/CustomItem/list.html.twig @@ -3,7 +3,7 @@ {% set fieldData = fieldData ?? null %} {% set target = '#'~namespace %} -{% extends isIndex ? 'MauticCoreBundle:Default:content.html.twig' : 'MauticCoreBundle:Default:raw_output.html.twig' %} +{% extends isIndex ? '@MauticCore/Default/content.html.twig' : '@MauticCore/Default/raw_output.html.twig' %} {% block mauticContent %}customItem{% endblock %} @@ -12,14 +12,14 @@ {% endblock %} {% block actions %} - {{ include('MauticCoreBundle:Helper:page_actions.html.twig') }} + {{ include('@MauticCore/Helper/page_actions.html.twig') }} {% endblock %} {% block content %}
    {% if isIndex %}
    - {{ include('MauticCoreBundle:Helper:list_toolbar.html.twig', { + {{ include('@MauticCore/Helper/list_toolbar.html.twig', { 'searchValue': searchValue, 'action': currentRoute, 'target': '#'~namespace, @@ -27,11 +27,11 @@ }) }}
    - {{ include('CustomObjectsBundle:CustomItem:_list.html.twig') }} + {{ include('@CustomObjects/CustomItem/_list.html.twig') }}
    {% else %} - {{ include('CustomObjectsBundle:CustomItem:_list.html.twig') }} + {{ include('@CustomObjects/CustomItem/_list.html.twig') }} {% endif %}
    {% endblock %} \ No newline at end of file diff --git a/Views/CustomObject/Form/Panel/_field.html.twig b/Resources/views/CustomObject/Form/Panel/_field.html.twig similarity index 100% rename from Views/CustomObject/Form/Panel/_field.html.twig rename to Resources/views/CustomObject/Form/Panel/_field.html.twig diff --git a/Resources/views/CustomObject/Form/Panel/checkbox_group.html.twig b/Resources/views/CustomObject/Form/Panel/checkbox_group.html.twig new file mode 100644 index 000000000..e226dbc02 --- /dev/null +++ b/Resources/views/CustomObject/Form/Panel/checkbox_group.html.twig @@ -0,0 +1 @@ +{% extends '@CustomObjects/CustomObject/Form\\Panel\\_field.html.twig' %} diff --git a/Resources/views/CustomObject/Form/Panel/country.html.twig b/Resources/views/CustomObject/Form/Panel/country.html.twig new file mode 100644 index 000000000..e226dbc02 --- /dev/null +++ b/Resources/views/CustomObject/Form/Panel/country.html.twig @@ -0,0 +1 @@ +{% extends '@CustomObjects/CustomObject/Form\\Panel\\_field.html.twig' %} diff --git a/Resources/views/CustomObject/Form/Panel/date.html.twig b/Resources/views/CustomObject/Form/Panel/date.html.twig new file mode 100644 index 000000000..e226dbc02 --- /dev/null +++ b/Resources/views/CustomObject/Form/Panel/date.html.twig @@ -0,0 +1 @@ +{% extends '@CustomObjects/CustomObject/Form\\Panel\\_field.html.twig' %} diff --git a/Resources/views/CustomObject/Form/Panel/datetime.html.twig b/Resources/views/CustomObject/Form/Panel/datetime.html.twig new file mode 100644 index 000000000..e226dbc02 --- /dev/null +++ b/Resources/views/CustomObject/Form/Panel/datetime.html.twig @@ -0,0 +1 @@ +{% extends '@CustomObjects/CustomObject/Form\\Panel\\_field.html.twig' %} diff --git a/Resources/views/CustomObject/Form/Panel/email.html.twig b/Resources/views/CustomObject/Form/Panel/email.html.twig new file mode 100644 index 000000000..e226dbc02 --- /dev/null +++ b/Resources/views/CustomObject/Form/Panel/email.html.twig @@ -0,0 +1 @@ +{% extends '@CustomObjects/CustomObject/Form\\Panel\\_field.html.twig' %} diff --git a/Resources/views/CustomObject/Form/Panel/hidden.html.twig b/Resources/views/CustomObject/Form/Panel/hidden.html.twig new file mode 100644 index 000000000..e226dbc02 --- /dev/null +++ b/Resources/views/CustomObject/Form/Panel/hidden.html.twig @@ -0,0 +1 @@ +{% extends '@CustomObjects/CustomObject/Form\\Panel\\_field.html.twig' %} diff --git a/Resources/views/CustomObject/Form/Panel/html_area.html.twig b/Resources/views/CustomObject/Form/Panel/html_area.html.twig new file mode 100644 index 000000000..e226dbc02 --- /dev/null +++ b/Resources/views/CustomObject/Form/Panel/html_area.html.twig @@ -0,0 +1 @@ +{% extends '@CustomObjects/CustomObject/Form\\Panel\\_field.html.twig' %} diff --git a/Resources/views/CustomObject/Form/Panel/int.html.twig b/Resources/views/CustomObject/Form/Panel/int.html.twig new file mode 100644 index 000000000..e226dbc02 --- /dev/null +++ b/Resources/views/CustomObject/Form/Panel/int.html.twig @@ -0,0 +1 @@ +{% extends '@CustomObjects/CustomObject/Form\\Panel\\_field.html.twig' %} diff --git a/Resources/views/CustomObject/Form/Panel/multiselect.html.twig b/Resources/views/CustomObject/Form/Panel/multiselect.html.twig new file mode 100644 index 000000000..e226dbc02 --- /dev/null +++ b/Resources/views/CustomObject/Form/Panel/multiselect.html.twig @@ -0,0 +1 @@ +{% extends '@CustomObjects/CustomObject/Form\\Panel\\_field.html.twig' %} diff --git a/Resources/views/CustomObject/Form/Panel/phone.html.twig b/Resources/views/CustomObject/Form/Panel/phone.html.twig new file mode 100644 index 000000000..e226dbc02 --- /dev/null +++ b/Resources/views/CustomObject/Form/Panel/phone.html.twig @@ -0,0 +1 @@ +{% extends '@CustomObjects/CustomObject/Form\\Panel\\_field.html.twig' %} diff --git a/Resources/views/CustomObject/Form/Panel/radio_group.html.twig b/Resources/views/CustomObject/Form/Panel/radio_group.html.twig new file mode 100644 index 000000000..e226dbc02 --- /dev/null +++ b/Resources/views/CustomObject/Form/Panel/radio_group.html.twig @@ -0,0 +1 @@ +{% extends '@CustomObjects/CustomObject/Form\\Panel\\_field.html.twig' %} diff --git a/Resources/views/CustomObject/Form/Panel/select.html.twig b/Resources/views/CustomObject/Form/Panel/select.html.twig new file mode 100644 index 000000000..e226dbc02 --- /dev/null +++ b/Resources/views/CustomObject/Form/Panel/select.html.twig @@ -0,0 +1 @@ +{% extends '@CustomObjects/CustomObject/Form\\Panel\\_field.html.twig' %} diff --git a/Resources/views/CustomObject/Form/Panel/text.html.twig b/Resources/views/CustomObject/Form/Panel/text.html.twig new file mode 100644 index 000000000..e226dbc02 --- /dev/null +++ b/Resources/views/CustomObject/Form/Panel/text.html.twig @@ -0,0 +1 @@ +{% extends '@CustomObjects/CustomObject/Form\\Panel\\_field.html.twig' %} diff --git a/Resources/views/CustomObject/Form/Panel/textarea.html.twig b/Resources/views/CustomObject/Form/Panel/textarea.html.twig new file mode 100644 index 000000000..8e26a3a45 --- /dev/null +++ b/Resources/views/CustomObject/Form/Panel/textarea.html.twig @@ -0,0 +1 @@ +{% extends '@CustomObjects/CustomObject/Form\\Panel\\_field.html.twig' %} \ No newline at end of file diff --git a/Resources/views/CustomObject/Form/Panel/url.html.twig b/Resources/views/CustomObject/Form/Panel/url.html.twig new file mode 100644 index 000000000..e226dbc02 --- /dev/null +++ b/Resources/views/CustomObject/Form/Panel/url.html.twig @@ -0,0 +1 @@ +{% extends '@CustomObjects/CustomObject/Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/_detail_left_section.html.twig b/Resources/views/CustomObject/_detail_left_section.html.twig similarity index 91% rename from Views/CustomObject/_detail_left_section.html.twig rename to Resources/views/CustomObject/_detail_left_section.html.twig index da1812ab0..8b1654671 100644 --- a/Views/CustomObject/_detail_left_section.html.twig +++ b/Resources/views/CustomObject/_detail_left_section.html.twig @@ -16,7 +16,7 @@
    - {{- include('MauticCoreBundle:Helper:list_actions.html.twig', { 'item' : item }) -}} + {{- include('@MauticCore/Helper/list_actions.html.twig', { 'item' : item }) -}}
    - {{ filterEntityId is empty ? include('MauticCoreBundle:Helper:publishstatus_icon.html.twig', { 'item' : item, 'model' : 'custom.item' }) : '' }} + {{ filterEntityId is empty ? include('@MauticCore/Helper/publishstatus_icon.html.twig', { 'item' : item, 'model' : 'custom.item' }) : '' }} {{ item.getName() }} @@ -67,7 +67,7 @@ {% if fieldData is not empty %} {% for fieldValue in fieldData.getFields(item.getId()) %}
    - {{- include('CustomObjectsBundle:CustomField:value.html.twig', { 'fieldValue' : fieldValue }) -}} + {{- include('@CustomObjects/CustomField/value.html.twig', { 'fieldValue' : fieldValue }) -}}
    - {{ include('MauticCoreBundle:Helper:details.html.twig', {'entity': customObject}) }} + {{ include('@MauticCore/Helper/details.html.twig', {'entity': customObject}) }}
    @@ -51,11 +51,11 @@
    - {{ include('MauticCoreBundle:Helper:graph_dateselect.html.twig', {'dateRangeForm': dateRangeForm, 'class': 'pull-right'}) }} + {{ include('@MauticCore/Helper/graph_dateselect.html.twig', {'dateRangeForm': dateRangeForm, 'class': 'pull-right'}) }}
    - {{ include('MauticCoreBundle:Helper:chart.html.twig', {'chartData': chartData, 'chartType': 'line', 'chartHeight': 300}) }} + {{ include('@MauticCore/Helper/chart.html.twig', {'chartData': chartData, 'chartType': 'line', 'chartHeight': 300}) }}
    diff --git a/Views/CustomObject/_detail_right_section.html.twig b/Resources/views/CustomObject/_detail_right_section.html.twig similarity index 60% rename from Views/CustomObject/_detail_right_section.html.twig rename to Resources/views/CustomObject/_detail_right_section.html.twig index 823880988..02d22b0ba 100644 --- a/Views/CustomObject/_detail_right_section.html.twig +++ b/Resources/views/CustomObject/_detail_right_section.html.twig @@ -1,6 +1,6 @@
    - {{ include('MauticCoreBundle:Helper:recentactivity.html.twig', {'logs': logs}) }} + {{ include('@MauticCore/Helper/recentactivity.html.twig', {'logs': logs}) }}
    \ No newline at end of file diff --git a/Views/CustomObject/_form-fields.html.twig b/Resources/views/CustomObject/_form-fields.html.twig similarity index 83% rename from Views/CustomObject/_form-fields.html.twig rename to Resources/views/CustomObject/_form-fields.html.twig index 55c774387..87f649c65 100644 --- a/Views/CustomObject/_form-fields.html.twig +++ b/Resources/views/CustomObject/_form-fields.html.twig @@ -5,7 +5,7 @@ {% if customFieldEntity.getId() not in deletedFields %} {{- include( - 'CustomObjectsBundle:CustomObject:Form\\Panel\\'~customFieldEntity.getType()~'.html.twig', + '@CustomObjects/CustomObject/Form\\Panel\\'~customFieldEntity.getType()~'.html.twig', { 'customField': customField, 'customObject': customObject, diff --git a/Views/CustomObject/_list.html.twig b/Resources/views/CustomObject/_list.html.twig similarity index 81% rename from Views/CustomObject/_list.html.twig rename to Resources/views/CustomObject/_list.html.twig index 660d06d12..1d6766b03 100644 --- a/Views/CustomObject/_list.html.twig +++ b/Resources/views/CustomObject/_list.html.twig @@ -7,7 +7,7 @@ - {{ include('MauticCoreBundle:Helper:tableheader.html.twig', { + {{ include('@MauticCore/Helper/tableheader.html.twig', { 'checkall': 'true', 'target': '#custom-objects-table', 'langVar': 'custom.object', @@ -15,14 +15,14 @@ 'routeBase': 'form' }) }} - {{ include('MauticCoreBundle:Helper:tableheader.html.twig', { + {{ include('@MauticCore/Helper/tableheader.html.twig', { 'sessionVar': sessionVar, 'orderBy': tableAlias~'.namePlural', 'text': 'mautic.core.name', 'class': 'col-custom_object_-name' }) }} - {{ include('MauticCoreBundle:Helper:tableheader.html.twig', { + {{ include('@MauticCore/Helper/tableheader.html.twig', { 'sessionVar': sessionVar, 'orderBy': tableAlias~'.id', 'text': 'mautic.core.id', @@ -34,11 +34,11 @@ {% for item in items %}
    - {{- include('MauticCoreBundle:Helper:list_actions.html.twig', { 'item': item }) -}} + {{- include('@MauticCore/Helper/list_actions.html.twig', { 'item': item }) -}}
    - {{- include('MauticCoreBundle:Helper:publishstatus_icon.html.twig', + {{- include('@MauticCore/Helper/publishstatus_icon.html.twig', {'item' : item, 'model' : 'custom.object'}) -}} {{ item.name }} @@ -60,7 +60,7 @@
    {% else %} - {{ include('MauticCoreBundle:Helper:noresults.html.twig', {'tip': 'custom.object.noresults.tip'}) }} + {{ include('@MauticCore/Helper/noresults.html.twig', {'tip': 'custom.object.noresults.tip'}) }} {% endif %} diff --git a/Views/CustomObject/detail.html.twig b/Resources/views/CustomObject/detail.html.twig similarity index 52% rename from Views/CustomObject/detail.html.twig rename to Resources/views/CustomObject/detail.html.twig index 4bca165f6..80ebb9534 100644 --- a/Views/CustomObject/detail.html.twig +++ b/Resources/views/CustomObject/detail.html.twig @@ -1,4 +1,4 @@ -{% extends 'MauticCoreBundle:Default:content.html.twig' %} +{% extends '@MauticCore/Default/content.html.twig' %} {% block mauticContent %}customObject{% endblock %} @@ -7,21 +7,21 @@ {% endblock %} {% block actions %} - {{ include('MauticCoreBundle:Helper:page_actions.html.twig', { 'item': customObject}) }} + {{ include('@MauticCore/Helper/page_actions.html.twig', { 'item': customObject}) }} {% endblock %} {% block publishStatus %} - {{- include('MauticCoreBundle:Helper:publishstatus_badge.html.twig', {'entity' : customObject}) -}} + {{- include('@MauticCore/Helper/publishstatus_badge.html.twig', {'entity' : customObject}) -}} {% endblock %} {% block content %}
    - {{ include('CustomObjectsBundle:CustomObject:_detail_left_section.html.twig', { + {{ include('@CustomObjects/CustomObject/_detail_left_section.html.twig', { 'entity': customObject, 'dateRangeForm': dateRangeForm, 'chartData': stats, 'mauticTemplateVars': mauticTemplateVars is defined ? mauticTemplateVars : {} }) }} - {{ include('CustomObjectsBundle:CustomObject:_detail_right_section.html.twig', {'logs': logs}) }} + {{ include('@CustomObjects/CustomObject/_detail_right_section.html.twig', {'logs': logs}) }}
    {% endblock %} \ No newline at end of file diff --git a/Views/CustomObject/form.html.twig b/Resources/views/CustomObject/form.html.twig similarity index 93% rename from Views/CustomObject/form.html.twig rename to Resources/views/CustomObject/form.html.twig index 235180fad..d630e8246 100644 --- a/Views/CustomObject/form.html.twig +++ b/Resources/views/CustomObject/form.html.twig @@ -1,4 +1,4 @@ -{% extends 'MauticCoreBundle:Default:content.html.twig' %} +{% extends '@MauticCore/Default/content.html.twig' %} {% block mauticContent %}customObject{% endblock %} @@ -46,7 +46,7 @@
    - {{- include('MauticFormBundle:Builder:_style.html.twig') -}} + {{- include('@MauticForm/Builder/_style.html.twig') -}}
    @@ -64,7 +64,7 @@
    - {{- include('CustomObjectsBundle:CustomObject:_form-fields.html.twig') -}} + {{- include('@CustomObjects/CustomObject/_form-fields.html.twig') -}}
    {% if 0 == customFields|length %}
    @@ -90,7 +90,7 @@ {% endblock %} {% block modal %} - {{ include('MauticCoreBundle:Helper:modal.html.twig', { + {{ include('@MauticCore/Helper/modal.html.twig', { 'id': 'objectFieldModal', 'header': false, 'footerButtons': true, diff --git a/Resources/views/CustomObject/list.html.twig b/Resources/views/CustomObject/list.html.twig new file mode 100644 index 000000000..6cb28b6ba --- /dev/null +++ b/Resources/views/CustomObject/list.html.twig @@ -0,0 +1,27 @@ +{% set isIndex = tmpl == 'index' ? true : false %} +{% set tmpl = 'list' %} + +{% extends isIndex ? '@MauticCore/Default/content.html.twig' : '@MauticCore/Default/raw_output.html.twig' %} + +{% block mauticContent %}customObject{% endblock %} + +{% block headerTitle %} + {{ 'custom.object.title'|trans }} +{% endblock %} + +{% block actions %} + {{ include('@MauticCore/Helper/page_actions.html.twig') }} +{% endblock %} + +{% block content %} + {% if isIndex %} +
    + {{ include('@MauticCore/Helper/list_toolbar.html.twig') }} +
    ! + {{ include('@CustomObjects/CustomObject/_list.html.twig') }} +
    +
    + {% else %} + {{ include('@CustomObjects/CustomObject/_list.html.twig') }} + {% endif %} +{% endblock %} \ No newline at end of file diff --git a/Views/FormTheme/FieldValueCondition/campaign_condition_field_value_widget.html.twig b/Resources/views/FormTheme/FieldValueCondition/campaign_condition_field_value_widget.html.twig similarity index 56% rename from Views/FormTheme/FieldValueCondition/campaign_condition_field_value_widget.html.twig rename to Resources/views/FormTheme/FieldValueCondition/campaign_condition_field_value_widget.html.twig index 3c1b71b88..35c606a32 100644 --- a/Views/FormTheme/FieldValueCondition/campaign_condition_field_value_widget.html.twig +++ b/Resources/views/FormTheme/FieldValueCondition/campaign_condition_field_value_widget.html.twig @@ -3,13 +3,13 @@ ?>
    - row($form['field']); ?> + {{ form_row(field) }}
    - row($form['operator']); ?> + {{ form_row(operator) }}
    - row($form['value']); ?> + {{ form_row(value) }}
    diff --git a/Views/SubscribedEvents/Tab/content.html.twig b/Resources/views/SubscribedEvents/Tab/content.html.twig similarity index 78% rename from Views/SubscribedEvents/Tab/content.html.twig rename to Resources/views/SubscribedEvents/Tab/content.html.twig index 6978d85d0..702c12c7f 100644 --- a/Views/SubscribedEvents/Tab/content.html.twig +++ b/Resources/views/SubscribedEvents/Tab/content.html.twig @@ -1,7 +1,7 @@ -
    +
    - {{ include('MauticCoreBundle:Helper:search.html.twig', { + {{ include('@MauticCore/Helper/search.html.twig', { 'searchValue': searchValue, 'action': searchRoute, 'searchId': searchId, @@ -10,7 +10,7 @@ }) }}
    + + \ No newline at end of file diff --git a/Views/SubscribedEvents/Tab/link.html.twig b/Resources/views/SubscribedEvents/Tab/link.html.twig similarity index 100% rename from Views/SubscribedEvents/Tab/link.html.twig rename to Resources/views/SubscribedEvents/Tab/link.html.twig diff --git a/Views/SubscribedEvents/Tab/modal.html.twig b/Resources/views/SubscribedEvents/Tab/modal.html.twig similarity index 50% rename from Views/SubscribedEvents/Tab/modal.html.twig rename to Resources/views/SubscribedEvents/Tab/modal.html.twig index b91a28994..70c836855 100644 --- a/Views/SubscribedEvents/Tab/modal.html.twig +++ b/Resources/views/SubscribedEvents/Tab/modal.html.twig @@ -1,6 +1,6 @@ {% block modal %} - {{ include('MauticCoreBundle:Helper:modal.html.twig', { + {{ include('@MauticCore/Helper/modal.html.twig', { 'id': 'customItemLookupModal', - 'size': xl + 'size': 'xl' }) }} {% endblock %} \ No newline at end of file diff --git a/Views/SubscribedEvents/Timeline/link.html.twig b/Resources/views/SubscribedEvents/Timeline/link.html.twig similarity index 100% rename from Views/SubscribedEvents/Timeline/link.html.twig rename to Resources/views/SubscribedEvents/Timeline/link.html.twig diff --git a/Views/CustomField/detail.html.twig b/Views/CustomField/detail.html.twig deleted file mode 100644 index 1ed2c0637..000000000 --- a/Views/CustomField/detail.html.twig +++ /dev/null @@ -1,19 +0,0 @@ -{% extends 'MauticCoreBundle:Default:content.html.twig.html.twig' %} - -{% block mauticContent %}customField{% endblock %} - -{% block headerTitle %} - {{ item.getName() }} -{% endblock %} - -{% block actions %} - {{ include('MauticCoreBundle:Helper:page_actions.html.twig', { 'item': item }) }} -{% endblock %} - -{% block content %} - -
    - {{ include('CustomObjectsBundle:CustomField:_detail_left_section.html.twig') }} - {{ include('CustomObjectsBundle:CustomField:_detail_right_section.html.twig', {'logs': logs}) }} -
    -{% endblock %} \ No newline at end of file diff --git a/Views/CustomObject/Form/Panel/checkbox_group.html.twig b/Views/CustomObject/Form/Panel/checkbox_group.html.twig deleted file mode 100644 index 0b2799f05..000000000 --- a/Views/CustomObject/Form/Panel/checkbox_group.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/country.html.twig b/Views/CustomObject/Form/Panel/country.html.twig deleted file mode 100644 index 0b2799f05..000000000 --- a/Views/CustomObject/Form/Panel/country.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/date.html.twig b/Views/CustomObject/Form/Panel/date.html.twig deleted file mode 100644 index 0b2799f05..000000000 --- a/Views/CustomObject/Form/Panel/date.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/datetime.html.twig b/Views/CustomObject/Form/Panel/datetime.html.twig deleted file mode 100644 index 0b2799f05..000000000 --- a/Views/CustomObject/Form/Panel/datetime.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/email.html.twig b/Views/CustomObject/Form/Panel/email.html.twig deleted file mode 100644 index 0b2799f05..000000000 --- a/Views/CustomObject/Form/Panel/email.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/hidden.html.twig b/Views/CustomObject/Form/Panel/hidden.html.twig deleted file mode 100644 index 0b2799f05..000000000 --- a/Views/CustomObject/Form/Panel/hidden.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/html_area.html.twig b/Views/CustomObject/Form/Panel/html_area.html.twig deleted file mode 100644 index 0b2799f05..000000000 --- a/Views/CustomObject/Form/Panel/html_area.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/int.html.twig b/Views/CustomObject/Form/Panel/int.html.twig deleted file mode 100644 index 0b2799f05..000000000 --- a/Views/CustomObject/Form/Panel/int.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/multiselect.html.twig b/Views/CustomObject/Form/Panel/multiselect.html.twig deleted file mode 100644 index 0b2799f05..000000000 --- a/Views/CustomObject/Form/Panel/multiselect.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/phone.html.twig b/Views/CustomObject/Form/Panel/phone.html.twig deleted file mode 100644 index 0b2799f05..000000000 --- a/Views/CustomObject/Form/Panel/phone.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/radio_group.html.twig b/Views/CustomObject/Form/Panel/radio_group.html.twig deleted file mode 100644 index 0b2799f05..000000000 --- a/Views/CustomObject/Form/Panel/radio_group.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/select.html.twig b/Views/CustomObject/Form/Panel/select.html.twig deleted file mode 100644 index 0b2799f05..000000000 --- a/Views/CustomObject/Form/Panel/select.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/text.html.twig b/Views/CustomObject/Form/Panel/text.html.twig deleted file mode 100644 index 0b2799f05..000000000 --- a/Views/CustomObject/Form/Panel/text.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/Form/Panel/textarea.html.twig b/Views/CustomObject/Form/Panel/textarea.html.twig deleted file mode 100644 index 4e16c7803..000000000 --- a/Views/CustomObject/Form/Panel/textarea.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} \ No newline at end of file diff --git a/Views/CustomObject/Form/Panel/url.html.twig b/Views/CustomObject/Form/Panel/url.html.twig deleted file mode 100644 index 0b2799f05..000000000 --- a/Views/CustomObject/Form/Panel/url.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends 'CustomObjectsBundle:CustomObject:Form\\Panel\\_field.html.twig' %} diff --git a/Views/CustomObject/list.html.twig b/Views/CustomObject/list.html.twig deleted file mode 100644 index 7b80f7a28..000000000 --- a/Views/CustomObject/list.html.twig +++ /dev/null @@ -1,27 +0,0 @@ -{% set isIndex = tmpl == 'index' ? true : false %} -{% set tmpl = 'list' %} - -{% extends isIndex ? 'MauticCoreBundle:Default:content.html.twig' : 'MauticCoreBundle:Default:raw_output.html.twig' %} - -{% block mauticContent %}customObject{% endblock %} - -{% block headerTitle %} - {{ 'custom.object.title'|trans }} -{% endblock %} - -{% block actions %} - {{ include('MauticCoreBundle:Helper:page_actions.html.twig') }} -{% endblock %} - -{% block content %} - {% if isIndex %} -
    - {{ include('MauticCoreBundle:Helper:list_toolbar.html.twig') }} -
    - {{ include('CustomObjectsBundle:CustomObject:_list.html.twig') }} -
    -
    - {% else %} - {{ include('CustomObjectsBundle:CustomObject:_list.html.twig') }} - {% endif %} -{% endblock %} \ No newline at end of file From cfff87a396cb507c403aa073a0b5fe3d49169241 Mon Sep 17 00:00:00 2001 From: Volha Pivavarchyk Date: Wed, 17 May 2023 01:09:25 +0300 Subject: [PATCH 6/9] update dependencies, links to twig templates --- EventListener/CustomItemButtonSubscriber.php | 2 +- EventListener/CustomItemTabSubscriber.php | 4 ++-- EventListener/CustomObjectButtonSubscriber.php | 2 +- .../EventListener/CustomItemTabSubscriberTest.php | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/EventListener/CustomItemButtonSubscriber.php b/EventListener/CustomItemButtonSubscriber.php index 5b2fdb61e..a7fd58b6b 100644 --- a/EventListener/CustomItemButtonSubscriber.php +++ b/EventListener/CustomItemButtonSubscriber.php @@ -6,7 +6,7 @@ use Mautic\CoreBundle\CoreEvents; use Mautic\CoreBundle\Event\CustomButtonEvent; -use Mautic\CoreBundle\Templating\Helper\ButtonHelper; +use Mautic\CoreBundle\Twig\Helper\ButtonHelper; use MauticPlugin\CustomObjectsBundle\Entity\CustomItem; use MauticPlugin\CustomObjectsBundle\Exception\ForbiddenException; use MauticPlugin\CustomObjectsBundle\Provider\CustomItemPermissionProvider; diff --git a/EventListener/CustomItemTabSubscriber.php b/EventListener/CustomItemTabSubscriber.php index e76f2f98c..436f47180 100644 --- a/EventListener/CustomItemTabSubscriber.php +++ b/EventListener/CustomItemTabSubscriber.php @@ -73,7 +73,7 @@ public static function getSubscribedEvents(): array public function injectTabs(CustomContentEvent $event): void { - if ($event->checkContext('CustomObjectsBundle:CustomItem:detail.html.twig', 'tabs')) { + if ($event->checkContext('@CustomObjects/CustomItem/detail.html.twig', 'tabs')) { $vars = $event->getVars(); $objects = $this->customObjectModel->getMasterCustomObjects(); @@ -98,7 +98,7 @@ public function injectTabs(CustomContentEvent $event): void $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:modal.html.twig'); } - if ($event->checkContext('CustomObjectsBundle:CustomItem:detail.html.twig', 'tabs.content')) { + if ($event->checkContext('@CustomObjects/CustomItem/detail.html.twig', 'tabs.content')) { $vars = $event->getVars(); $objects = $this->getCustomObjects(); diff --git a/EventListener/CustomObjectButtonSubscriber.php b/EventListener/CustomObjectButtonSubscriber.php index 63d801a70..d07412bf3 100644 --- a/EventListener/CustomObjectButtonSubscriber.php +++ b/EventListener/CustomObjectButtonSubscriber.php @@ -6,7 +6,7 @@ use Mautic\CoreBundle\CoreEvents; use Mautic\CoreBundle\Event\CustomButtonEvent; -use Mautic\CoreBundle\Templating\Helper\ButtonHelper; +use Mautic\CoreBundle\Twig\Helper\ButtonHelper; use MauticPlugin\CustomObjectsBundle\Entity\CustomObject; use MauticPlugin\CustomObjectsBundle\Exception\ForbiddenException; use MauticPlugin\CustomObjectsBundle\Provider\CustomItemPermissionProvider; diff --git a/Tests/Unit/EventListener/CustomItemTabSubscriberTest.php b/Tests/Unit/EventListener/CustomItemTabSubscriberTest.php index d6636a2be..be48860bb 100644 --- a/Tests/Unit/EventListener/CustomItemTabSubscriberTest.php +++ b/Tests/Unit/EventListener/CustomItemTabSubscriberTest.php @@ -105,8 +105,8 @@ public function testForTabsContext(): void $this->customContentEvent ->method('checkContext') ->withConsecutive( - ['CustomObjectsBundle:CustomItem:detail.html.twig', 'tabs'], - ['CustomObjectsBundle:CustomItem:detail.html.twig', 'tabs.content'] + ['@CustomObjects/CustomItem/detail.html.twig', 'tabs'], + ['@CustomObjects/CustomItem/detail.html.twig', 'tabs.content'] ) ->willReturnOnConsecutiveCalls(true, false); @@ -158,8 +158,8 @@ public function testForTabsContextWhenTheCustomItemMatchesCustomObject(): void $this->customContentEvent ->method('checkContext') ->withConsecutive( - ['CustomObjectsBundle:CustomItem:detail.html.twig', 'tabs'], - ['CustomObjectsBundle:CustomItem:detail.html.twig', 'tabs.content'] + ['@CustomObjects/CustomItem/detail.html.twig', 'tabs'], + ['@CustomObjects/CustomItem/detail.html.twig', 'tabs.content'] ) ->willReturn(true, false); @@ -194,8 +194,8 @@ public function testForTabContentsContext(): void $this->customContentEvent ->method('checkContext') ->withConsecutive( - ['CustomObjectsBundle:CustomItem:detail.html.twig', 'tabs'], - ['CustomObjectsBundle:CustomItem:detail.html.twig', 'tabs.content'] + ['@CustomObjects/CustomItem/detail.html.twig', 'tabs'], + ['@CustomObjects/CustomItem/detail.html.twig', 'tabs.content'] ) ->willReturn(false, true); From be5e5706ac2e7b78fd9c24d04fbd187ff5d9844f Mon Sep 17 00:00:00 2001 From: Volha Pivavarchyk Date: Wed, 17 May 2023 01:26:03 +0300 Subject: [PATCH 7/9] update links to twig templates --- Config/config.php | 16 ++++++++-------- Controller/CustomItem/BatchDeleteController.php | 2 +- Controller/CustomItem/CancelController.php | 2 +- Controller/CustomItem/DeleteController.php | 2 +- Controller/CustomObject/CancelController.php | 2 +- EventListener/ContactSubscriber.php | 2 +- EventListener/ContactTabSubscriber.php | 10 +++++----- .../Unit/EventListener/ContactSubscriberTest.php | 4 ++-- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Config/config.php b/Config/config.php index 00c99c2a8..6b91a9bc6 100644 --- a/Config/config.php +++ b/Config/config.php @@ -392,14 +392,14 @@ ], ], ], - 'custom_item.contact_list_controller' => [ - 'class' => \MauticPlugin\CustomObjectsBundle\Controller\CustomItem\ContactListController::class, - 'methodCalls' => [ - 'setContainer' => [ - '@service_container', - ], - ], - ], +// 'custom_item.contact_list_controller' => [ +// 'class' => \MauticPlugin\CustomObjectsBundle\Controller\CustomItem\ContactListController::class, +// 'methodCalls' => [ +// 'setContainer' => [ +// '@service_container', +// ], +// ], +// ], 'custom_item.export_controller' => [ 'class' => \MauticPlugin\CustomObjectsBundle\Controller\CustomItem\ExportController::class, 'arguments' => [ diff --git a/Controller/CustomItem/BatchDeleteController.php b/Controller/CustomItem/BatchDeleteController.php index aacfc6306..88e5e19be 100644 --- a/Controller/CustomItem/BatchDeleteController.php +++ b/Controller/CustomItem/BatchDeleteController.php @@ -112,7 +112,7 @@ public function deleteAction(int $objectId): Response [ 'returnUrl' => $this->routeProvider->buildListRoute($objectId, $page), 'viewParameters' => ['objectId' => $objectId, 'page' => $page], - 'contentTemplate' => 'CustomObjectsBundle:CustomItem\List:list', + 'contentTemplate' => '@CustomObjects/CustomObject/List/list.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customItem', ], diff --git a/Controller/CustomItem/CancelController.php b/Controller/CustomItem/CancelController.php index 7179f1f07..c5ab64e78 100644 --- a/Controller/CustomItem/CancelController.php +++ b/Controller/CustomItem/CancelController.php @@ -54,7 +54,7 @@ public function cancelAction(int $objectId, ?int $itemId = null): Response [ 'returnUrl' => $this->routeProvider->buildListRoute($objectId, $page), 'viewParameters' => ['objectId' => $objectId, 'page' => $page], - 'contentTemplate' => 'CustomObjectsBundle:CustomItem\List:list', + 'contentTemplate' => '@CustomObjects/CustomObject/List/list.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customItem', ], diff --git a/Controller/CustomItem/DeleteController.php b/Controller/CustomItem/DeleteController.php index cb9e4c578..5f5dbbf4e 100644 --- a/Controller/CustomItem/DeleteController.php +++ b/Controller/CustomItem/DeleteController.php @@ -83,7 +83,7 @@ public function deleteAction(int $objectId, int $itemId): Response [ 'returnUrl' => $this->routeProvider->buildListRoute($objectId, $page), 'viewParameters' => ['objectId' => $objectId, 'page' => $page], - 'contentTemplate' => 'CustomObjectsBundle:CustomItem\List:list', + 'contentTemplate' => '@CustomObjects/CustomObject/List/list.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customItem', ], diff --git a/Controller/CustomObject/CancelController.php b/Controller/CustomObject/CancelController.php index d0c0ec82f..e0b76bda3 100644 --- a/Controller/CustomObject/CancelController.php +++ b/Controller/CustomObject/CancelController.php @@ -50,7 +50,7 @@ public function cancelAction(?int $objectId): Response [ 'returnUrl' => $this->routeProvider->buildListRoute($page), 'viewParameters' => ['page' => $page], - 'contentTemplate' => 'CustomObjectsBundle:CustomObject\List:list', + 'contentTemplate' => '@CustomObjects/CustomObject/List/list.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customObject', ], diff --git a/EventListener/ContactSubscriber.php b/EventListener/ContactSubscriber.php index 4f7d11c79..611a73b2d 100644 --- a/EventListener/ContactSubscriber.php +++ b/EventListener/ContactSubscriber.php @@ -142,7 +142,7 @@ private function addLinkTimelineEntry(LeadTimelineEvent $event, string $eventTyp 'icon' => "fa-{$action}", 'extra' => $link, 'contactId' => $link['lead_id'], - 'contentTemplate' => 'CustomObjectsBundle:SubscribedEvents\Timeline:link.html.twig', + 'contentTemplate' => '@CustomObjects/SubscribedEvents/Timeline/link.html.twig', ]); } } diff --git a/EventListener/ContactTabSubscriber.php b/EventListener/ContactTabSubscriber.php index b3bc1a159..15e32138c 100644 --- a/EventListener/ContactTabSubscriber.php +++ b/EventListener/ContactTabSubscriber.php @@ -85,7 +85,7 @@ public function injectTabs(CustomContentEvent $event): void return; } - if ($event->checkContext('MauticLeadBundle:Lead:lead.html.twig', 'tabs')) { + if ($event->checkContext('tabs')) { $vars = $event->getVars(); $objects = $this->customObjectModel->getMasterCustomObjects(); @@ -100,13 +100,13 @@ public function injectTabs(CustomContentEvent $event): void 'tabId' => "custom-object-{$object->getId()}", ]; - $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:link.html.twig', $data); + $event->addTemplate('@CustomObjects/SubscribedEvents/Tab/link.html.twig', $data); } - $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:modal.html.twig'); + $event->addTemplate('@CustomObjects/SubscribedEvents/Tab/modal.html.twig'); } - if ($event->checkContext('MauticLeadBundle:Lead:lead.html.twig', 'tabs.content')) { + if ($event->checkContext( 'tabs.content')) { $vars = $event->getVars(); $objects = $this->getCustomObjects(); @@ -133,7 +133,7 @@ public function injectTabs(CustomContentEvent $event): void 'namespace' => $sessionProvider->getNamespace(), ]; - $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:content.html.twig', $data); + $event->addTemplate('@CustomObjects/SubscribedEvents/Tab/content.html.twig', $data); } } } diff --git a/Tests/Unit/EventListener/ContactSubscriberTest.php b/Tests/Unit/EventListener/ContactSubscriberTest.php index ba00ea21e..48b74d5d9 100644 --- a/Tests/Unit/EventListener/ContactSubscriberTest.php +++ b/Tests/Unit/EventListener/ContactSubscriberTest.php @@ -176,7 +176,7 @@ public function testPluginEnabledOnPublicPageWhenItemFound(): void 'id' => 444, ], 'contactId' => 333, - 'contentTemplate' => 'CustomObjectsBundle:SubscribedEvents\Timeline:link.html.twig', + '@CustomObjects/SubscribedEvents/Timeline/link.html.twig', ]); $this->subscriber->onTimelineGenerate($this->leadTimelineEvent); @@ -273,7 +273,7 @@ public function testPluginEnabledOnPublicPageWhenItemNotFound(): void 'id' => 444, ], 'contactId' => 333, - 'contentTemplate' => 'CustomObjectsBundle:SubscribedEvents\Timeline:link.html.twig', + 'contentTemplate' => '@CustomObjects/SubscribedEvents/Timeline/link.html.twig', ]); $this->subscriber->onTimelineGenerate($this->leadTimelineEvent); From 212d4334cbb6df975b7e13e4038c86277f1391c9 Mon Sep 17 00:00:00 2001 From: Volha Pivavarchyk Date: Wed, 17 May 2023 01:34:36 +0300 Subject: [PATCH 8/9] modify links to twig templates --- Config/config.php | 4 ++-- Controller/CustomItem/BatchDeleteController.php | 2 +- Controller/CustomItem/CancelController.php | 2 +- Controller/CustomItem/DeleteController.php | 2 +- Controller/CustomItem/LinkFormController.php | 4 ++-- Controller/CustomItem/SaveController.php | 6 +++--- Controller/CustomItem/ViewController.php | 2 +- Controller/CustomObject/CancelController.php | 2 +- Controller/CustomObject/DeleteController.php | 2 +- Controller/JsonController.php | 2 +- EventListener/ContactTabSubscriber.php | 4 ++-- EventListener/CustomItemTabSubscriber.php | 7 +++---- 12 files changed, 19 insertions(+), 20 deletions(-) diff --git a/Config/config.php b/Config/config.php index 6b91a9bc6..db0b5d4c1 100644 --- a/Config/config.php +++ b/Config/config.php @@ -126,12 +126,12 @@ ], CustomItemRouteProvider::ROUTE_EXPORT_ACTION => [ 'path' => 'custom/object/{object}/export', - 'controller' => 'CustomObjectsBundle:CustomItem\Export:export', + 'controller' => 'MauticPlugin\CustomObjectsBundle\Controller\CustomItem\ExportController::exportAction', 'method' => 'POST', ], CustomItemRouteProvider::ROUTE_EXPORT_DOWNLOAD_ACTION => [ 'path' => '/custom/item/export/download/{fileName}', - 'controller' => 'CustomObjectsBundle:CustomItem\Export:downloadExport', + 'controller' => 'MauticPlugin\CustomObjectsBundle\Controller\CustomItem\ExportController::downloadExportAction', ], // Custom Objects diff --git a/Controller/CustomItem/BatchDeleteController.php b/Controller/CustomItem/BatchDeleteController.php index 88e5e19be..232aa10cd 100644 --- a/Controller/CustomItem/BatchDeleteController.php +++ b/Controller/CustomItem/BatchDeleteController.php @@ -112,7 +112,7 @@ public function deleteAction(int $objectId): Response [ 'returnUrl' => $this->routeProvider->buildListRoute($objectId, $page), 'viewParameters' => ['objectId' => $objectId, 'page' => $page], - 'contentTemplate' => '@CustomObjects/CustomObject/List/list.html.twig', + 'contentTemplate' => 'MauticPlugin\CustomObjectsBundle\Controller\CustomItem\ListController::listAction', 'passthroughVars' => [ 'mauticContent' => 'customItem', ], diff --git a/Controller/CustomItem/CancelController.php b/Controller/CustomItem/CancelController.php index c5ab64e78..944623996 100644 --- a/Controller/CustomItem/CancelController.php +++ b/Controller/CustomItem/CancelController.php @@ -54,7 +54,7 @@ public function cancelAction(int $objectId, ?int $itemId = null): Response [ 'returnUrl' => $this->routeProvider->buildListRoute($objectId, $page), 'viewParameters' => ['objectId' => $objectId, 'page' => $page], - 'contentTemplate' => '@CustomObjects/CustomObject/List/list.html.twig', + 'contentTemplate' => 'MauticPlugin\CustomObjectsBundle\Controller\CustomItem\ListController::listAction', 'passthroughVars' => [ 'mauticContent' => 'customItem', ], diff --git a/Controller/CustomItem/DeleteController.php b/Controller/CustomItem/DeleteController.php index 5f5dbbf4e..7a350e5b5 100644 --- a/Controller/CustomItem/DeleteController.php +++ b/Controller/CustomItem/DeleteController.php @@ -83,7 +83,7 @@ public function deleteAction(int $objectId, int $itemId): Response [ 'returnUrl' => $this->routeProvider->buildListRoute($objectId, $page), 'viewParameters' => ['objectId' => $objectId, 'page' => $page], - 'contentTemplate' => '@CustomObjects/CustomObject/List/list.html.twig', + 'contentTemplate' => 'MauticPlugin\CustomObjectsBundle\Controller\CustomItem\ListController::listAction', 'passthroughVars' => [ 'mauticContent' => 'customItem', ], diff --git a/Controller/CustomItem/LinkFormController.php b/Controller/CustomItem/LinkFormController.php index f3b0e9f67..d554610f7 100644 --- a/Controller/CustomItem/LinkFormController.php +++ b/Controller/CustomItem/LinkFormController.php @@ -109,7 +109,7 @@ public function formAction(int $itemId, string $entityType, int $entityId): Resp $responseData = [ 'closeModal' => true, - 'flashes' => $this->renderView('MauticCoreBundle:Notification:flash_messages.html.twig'), + 'flashes' => $this->renderView('@MauticCore/Notification/flash_messages.html.twig'), ]; return new JsonResponse($responseData); @@ -152,7 +152,7 @@ public function saveAction(int $itemId, string $entityType, int $entityId): Resp $responseData = [ 'closeModal' => true, 'callback' => $callback, - 'flashes' => $this->renderView('MauticCoreBundle:Notification:flash_messages.html.twig'), + 'flashes' => $this->renderView('@MauticCore/Notification/flash_messages.html.twig'), ]; return new JsonResponse($responseData); diff --git a/Controller/CustomItem/SaveController.php b/Controller/CustomItem/SaveController.php index c00048b61..8d2dbb4ab 100644 --- a/Controller/CustomItem/SaveController.php +++ b/Controller/CustomItem/SaveController.php @@ -156,8 +156,8 @@ public function saveAction(int $objectId, ?int $itemId = null): Response ); $saveClicked = $form->get('buttons')->get('save')->isClicked(); - $detailView = 'CustomObjectsBundle:CustomItem\View:view'; - $formView = 'CustomObjectsBundle:CustomItem\Form:edit'; + $detailView = 'MauticPlugin\CustomObjectsBundle\Controller\CustomItem\ViewController:viewAction'; + $formView = 'MauticPlugin\CustomObjectsBundle\Controller\CustomItem\FormController:editAction'; $pathParameters = [ 'objectId' => $objectId, @@ -178,7 +178,7 @@ public function saveAction(int $objectId, ?int $itemId = null): Response return $this->redirectToRoute('mautic_contact_action', ['objectAction' => 'view', 'objectId' => $contactId]); } - $formView = 'CustomObjectsBundle:CustomItem\Form:editWithRedirectToContact'; + $formView = 'MauticPlugin\CustomObjectsBundle\Controller\CustomItem\FormController:editWithRedirectToContactAction'; $pathParameters['contactId'] = $contactId; } diff --git a/Controller/CustomItem/ViewController.php b/Controller/CustomItem/ViewController.php index 5f590e88f..1027d28ee 100644 --- a/Controller/CustomItem/ViewController.php +++ b/Controller/CustomItem/ViewController.php @@ -106,7 +106,7 @@ public function viewAction(int $objectId, int $itemId): Response 'stats' => $stats, 'logs' => $auditLogs, 'contacts' => $this->forward( - 'CustomObjectsBundle:CustomItem\ContactList:list', + 'MauticPlugin\CustomObjectsBundle\Controller\CustomItem\ContactListController::listAction', [ 'objectId' => $itemId, 'page' => 1, diff --git a/Controller/CustomObject/CancelController.php b/Controller/CustomObject/CancelController.php index e0b76bda3..6136eeedd 100644 --- a/Controller/CustomObject/CancelController.php +++ b/Controller/CustomObject/CancelController.php @@ -50,7 +50,7 @@ public function cancelAction(?int $objectId): Response [ 'returnUrl' => $this->routeProvider->buildListRoute($page), 'viewParameters' => ['page' => $page], - 'contentTemplate' => '@CustomObjects/CustomObject/List/list.html.twig', + 'contentTemplate' => 'MauticPlugin\CustomObjectsBundle\Controller\CustomObject\ListController:listAction', 'passthroughVars' => [ 'mauticContent' => 'customObject', ], diff --git a/Controller/CustomObject/DeleteController.php b/Controller/CustomObject/DeleteController.php index 3bd6e6b95..179c433d1 100644 --- a/Controller/CustomObject/DeleteController.php +++ b/Controller/CustomObject/DeleteController.php @@ -60,7 +60,7 @@ public function __construct( public function deleteAction(int $objectId): Response { - $controller = 'CustomObjectsBundle:CustomObject\List:list'; + $controller = 'MauticPlugin\CustomObjectsBundle\Controller\CustomObject\ListController:listAction'; $page = [ 'page' => $this->sessionProviderFactory->createObjectProvider()->getPage(), ]; diff --git a/Controller/JsonController.php b/Controller/JsonController.php index 111e77d80..a83d71f4c 100644 --- a/Controller/JsonController.php +++ b/Controller/JsonController.php @@ -16,7 +16,7 @@ class JsonController extends Controller */ protected function renderJson(array $responseData = []): JsonResponse { - $responseData['flashes'] = $this->renderView('MauticCoreBundle:Notification:flash_messages.html.twig'); + $responseData['flashes'] = $this->renderView('@MauticCore/Notification/flash_messages.html.twig'); return new JsonResponse($responseData); } diff --git a/EventListener/ContactTabSubscriber.php b/EventListener/ContactTabSubscriber.php index 15e32138c..b38ca4835 100644 --- a/EventListener/ContactTabSubscriber.php +++ b/EventListener/ContactTabSubscriber.php @@ -85,7 +85,7 @@ public function injectTabs(CustomContentEvent $event): void return; } - if ($event->checkContext('tabs')) { + if ($event->checkContext('@MauticLead/Lead/lead.html.twig', 'tabs')) { $vars = $event->getVars(); $objects = $this->customObjectModel->getMasterCustomObjects(); @@ -106,7 +106,7 @@ public function injectTabs(CustomContentEvent $event): void $event->addTemplate('@CustomObjects/SubscribedEvents/Tab/modal.html.twig'); } - if ($event->checkContext( 'tabs.content')) { + if ($event->checkContext( '@MauticLead/Lead/lead.html.twig','tabs.content')) { $vars = $event->getVars(); $objects = $this->getCustomObjects(); diff --git a/EventListener/CustomItemTabSubscriber.php b/EventListener/CustomItemTabSubscriber.php index 436f47180..9841a756a 100644 --- a/EventListener/CustomItemTabSubscriber.php +++ b/EventListener/CustomItemTabSubscriber.php @@ -92,10 +92,10 @@ public function injectTabs(CustomContentEvent $event): void 'tabId' => "custom-object-{$object->getId()}", ]; - $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:link.html.twig', $data); + $event->addTemplate('@CustomObjects/SubscribedEvents/Tab/link.html.twig', $data); } - $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:modal.html.twig'); + $event->addTemplate('@CustomObjects/SubscribedEvents/Tab/modal.html.twig'); } if ($event->checkContext('@CustomObjects/CustomItem/detail.html.twig', 'tabs.content')) { @@ -129,8 +129,7 @@ public function injectTabs(CustomContentEvent $event): void 'namespace' => $sessionProvider->getNamespace(), ]; - $event->addTemplate('CustomObjectsBundle:SubscribedEvents/Tab:content.html.twig', $data); - } + $event->addTemplate('@CustomObjects/SubscribedEvents/Tab/content.html.twig', $data); } } } From 4f9fe529d9e1697634198ed6728c60bf6be4cfb7 Mon Sep 17 00:00:00 2001 From: Volha Pivavarchyk Date: Wed, 17 May 2023 10:40:36 +0300 Subject: [PATCH 9/9] fix a link to twig template --- Controller/CustomItem/ListController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controller/CustomItem/ListController.php b/Controller/CustomItem/ListController.php index 000780a83..0d7cb338c 100644 --- a/Controller/CustomItem/ListController.php +++ b/Controller/CustomItem/ListController.php @@ -124,7 +124,7 @@ public function listAction(int $objectId, int $page = 1): Response 'sessionVar' => $namespace, 'namespace' => $namespace, ], - 'contentTemplate' => 'CustomObjectsBundle:CustomItem:list.html.twig', + 'contentTemplate' => '@CustomObjects/CustomItem/list.html.twig', 'passthroughVars' => [ 'mauticContent' => 'customItem', 'route' => $filterEntityType ? null : $route,