Beispiel #1
0
 public function onMainFooterBody(HookRenderBlockEvent $event)
 {
     $content = trim($this->render("main-footer-body.html"));
     if ("" != $content) {
         $event->add(array("id" => "social-footer-body", "class" => "social", "title" => $this->trans("Follow us", array(), "hooksocial.fo.default"), "content" => $content));
     }
 }
Beispiel #2
0
 public function onMainFooterBody(HookRenderBlockEvent $event)
 {
     $content = trim($this->render("main-footer-body.html"));
     if ("" != $content) {
         $event->add(array("id" => "links-footer-body", "class" => "default", "title" => $this->trans("Useful links", array(), "hooklinks.fo.default"), "content" => $content));
     }
 }
 public function onMainTopMenuTools(HookRenderBlockEvent $event)
 {
     $isGranted = $this->securityContext->isGranted(["ADMIN"], [], [BoSearch::getModuleCode()], [AccessManager::VIEW]);
     if ($isGranted) {
         $event->add(['title' => $this->trans('Search product', [], BoSearch::DOMAIN_NAME), 'url' => $this->router->generate('bosearch.product.view')]);
     }
 }
Beispiel #4
0
 public function onMainFooterBody(HookRenderBlockEvent $event)
 {
     $content = trim($this->render("main-footer-body.html"));
     if ("" != $content) {
         $event->add(array("id" => "contact-footer-body", "class" => "contact", "title" => $this->trans("Contact", array(), "hookcontact"), "content" => $content));
     }
 }
Beispiel #5
0
 public function blockTheliaInformation(HookRenderBlockEvent $event)
 {
     $content = trim($this->render("block-thelia-information.html"));
     if (!empty($content)) {
         $event->add(["id" => "block-thelia-information", "title" => $this->trans("Thelia informations", [], HookAdminHome::DOMAIN_NAME), "content" => $content]);
     }
 }
 public function onDealerEditTab(HookRenderBlockEvent $event)
 {
     if ($this->checkAuth(DealerTeam::RESOURCES_TEAM, [], AccessManager::VIEW)) {
         $lang = $this->getSession()->getLang();
         $event->add(["id" => "dealerteam", "class" => "", "title" => $this->transQuick("Team", $lang->getLocale()), "content" => $this->render("dealerteam.html", $event->getArguments())]);
     }
 }
Beispiel #7
0
 public function onMainFooterBody(HookRenderBlockEvent $event)
 {
     $content = trim($this->render("main-footer-body.html"));
     if ("" != $content) {
         $event->add(array("id" => "navigation-footer-body", "class" => "links", "title" => $this->trans("Latest articles", array(), "hooknavigation"), "content" => $content));
     }
 }
Beispiel #8
0
 public function onMainFooterBody(HookRenderBlockEvent $event)
 {
     $bodyConfig = HookNavigation::getConfigValue(HookNavigationConfigValue::FOOTER_BODY_FOLDER_ID);
     $content = trim($this->render('main-footer-body.html', ['bodyFolderId' => $bodyConfig]));
     if ('' != $content) {
         $event->add(array('id' => 'navigation-footer-body', 'class' => 'links', 'title' => $this->trans('Latest articles', array(), HookNavigation::MESSAGE_DOMAIN), 'content' => $content));
     }
 }
 /**
  * Insert the legacy product attributes configuration tab.
  *
  * @param HookRenderBlockEvent $event
  */
 public function onProductTab(HookRenderBlockEvent $event)
 {
     $product = ProductQuery::create()->findPk($event->getArgument('id'));
     $productCheckEvent = new ProductCheckEvent($this->getRequest()->getProductId());
     $this->dispatcher->dispatch(LegacyProductAttributesEvents::PRODUCT_CHECK_LEGACY_ATTRIBUTES_APPLY, $productCheckEvent);
     if (!$productCheckEvent->getResult()) {
         $content = $this->render('product-edit-tab-legacy-product-attributes-does-not-apply.html');
     } elseif ($product->getTemplate() === null) {
         $content = $this->render('product-edit-tab-legacy-product-attributes-no-template.html');
     } else {
         $content = $this->render('product-edit-tab-legacy-product-attributes.html');
     }
     $event->add(['id' => 'legacy-product-attributes', 'title' => Translator::getInstance()->trans('Attributes configuration', [], LegacyProductAttributes::MESSAGE_DOMAIN_BO), 'content' => $content]);
 }
 public function onAccountAdditional(HookRenderBlockEvent $event)
 {
     $customer = $this->getCustomer();
     if (is_null($customer)) {
         // No customer => nothing to do.
         return;
     }
     $customerId = $customer->getId();
     if ($customerId <= 0) {
         // Wrong customer => return.
         return;
     }
     $title = $this->trans('My customer family', [], CustomerFamily::MESSAGE_DOMAIN);
     $event->add(array('id' => $customerId, 'title' => $title, 'content' => $this->render('account-additional.html', array('customerId' => $customerId, 'messageDomain' => CustomerFamily::MESSAGE_DOMAIN, 'particular' => CustomerFamily::CUSTOMER_FAMILY_PARTICULAR, 'title' => $title))));
 }
 public function onMainTopMenuTools(HookRenderBlockEvent $event)
 {
     $event->add(array('url' => URL::getInstance()->absoluteUrl('/admin/module/Diaporamas/diaporama'), 'title' => Translator::getInstance()->trans('diaporama.menu_title', array(), Diaporamas::BO_MESSAGE_DOMAIN)));
 }
Beispiel #12
0
 public function onMainFooterBody(HookRenderBlockEvent $event)
 {
     $event->addFragment(new Fragment(array("id" => "id1", "class" => "class1", "content" => "content1")));
     $event->add(array("id" => "id2", "class" => "class2", "content" => "content2"));
 }
Beispiel #13
0
 /**
  * Process the content of the hook block.
  *
  * {hookblock name="hook_code" var1="value1" var2="value2" ... }
  *
  * This function create an event, feed it with the custom variables passed to the function (var1, var2, ...) and
  * dispatch it to the hooks that respond to it.
  *
  * The name of the event is `hook.{context}.{hook_code}` where :
  *      * context : the id of the context of the smarty render : 1: frontoffice, 2: backoffice, 3: email, 4: pdf
  *      * hook_code : the code of the hook
  *
  * The event collects all the fragments generated by modules that listen to this event and add it to a fragmentBag.
  * This fragmentBag is not used directly. This is the forhook block that iterates over the fragmentBag to inject
  * data in the template.
  *
  * @param array        $params
  * @param string       $content
  * @param \TheliaSmarty\Template\SmartyParser $smarty
  * @param bool         $repeat
  *
  * @return string the generated content
  */
 public function processHookBlock($params, $content, $smarty, &$repeat)
 {
     $hookName = $this->getParam($params, 'name');
     $module = intval($this->getParam($params, 'module', 0));
     // explicit definition of variable that can be returned
     $fields = preg_replace('|[^a-zA-Z0-9,\\-_]|', '', $this->getParam($params, 'fields', ''));
     $fields = '' !== $fields ? explode(",", $fields) : [];
     if (!$repeat) {
         if ($this->debug && $smarty->getRequest()->get('SHOW_HOOK')) {
             $content = sprintf('<div style="background-color: #C82D26; color: #fff; border-color: #000000; border: solid;">%s</div>', $hookName) . $content;
         }
         return $content;
     }
     $type = $smarty->getTemplateDefinition()->getType();
     $event = new HookRenderBlockEvent($hookName, $params, $fields);
     $event->setArguments($this->getArgumentsFromParams($params));
     $eventName = sprintf('hook.%s.%s', $type, $hookName);
     // this is a hook specific to a module
     if (0 !== $module) {
         $eventName .= '.' . $module;
     }
     $this->getDispatcher()->dispatch($eventName, $event);
     // save results so we can use it in forHook block
     $this->hookResults[$hookName] = $event->get();
 }
Beispiel #14
0
 public function testBlock(HookRenderBlockEvent $event)
 {
     $event->add(['id' => '1', 'content' => $this->render('test-block.html.twig')])->add(['id' => '2', 'class' => 'class2', 'content' => $this->render('test-block.html.twig', ["myVar" => "content 2"]), 'other' => 'other variable']);
 }
 public function onMainTopMenuToolsContents(HookRenderBlockEvent $event)
 {
     $event->add(array("id" => "menuTools", "class" => '', "url" => URL::getInstance()->absoluteUrl('/admin/modules/menu/gestion'), "title" => $this->trans("Menu")));
 }
Beispiel #16
0
 /**
  * Add a new entry in the admin tools menu
  *
  * should add to event a fragment with fields : id,class,url,title
  *
  * @param HookRenderBlockEvent $event
  */
 public function onMainTopMenuTools(HookRenderBlockEvent $event)
 {
     $event->add(['id' => 'tools_menu_comment', 'class' => '', 'url' => URL::getInstance()->absoluteUrl('/admin/module/comments'), 'title' => $this->trans('Comments', [], Comment::MESSAGE_DOMAIN)]);
 }
 public function onMainTopMenuTools(HookRenderBlockEvent $event)
 {
     $event->add(array("url" => URL::getInstance()->absoluteUrl("/admin/module/GoogleShopping?current_tab=management"), "title" => $this->trans("Google catalog management", [], GoogleShopping::DOMAIN_NAME)));
 }
 /**
  * Insert a link to the ACL configuration page in the tool menu.
  * @param HookRenderBlockEvent $event Render event.
  */
 public function customerGroupAclHookTool(HookRenderBlockEvent $event)
 {
     $event->add(["url" => URL::getInstance()->absoluteUrl("/admin/module/CustomerGroupAcl"), "title" => $this->trans("Customer Group Acl", [], CustomerGroupAcl::DOMAIN_MESSAGE)]);
 }
Beispiel #19
0
 public function onMainTopMenuTools(HookRenderBlockEvent $event)
 {
     $event->add(['id' => 'top-menu-tools-tntfrance', 'class' => '', 'url' => URL::getInstance()->absoluteUrl('/admin/module/TNTFrance/orders'), 'title' => $this->trans('TNT Orders', [], TNTFrance::MESSAGE_DOMAIN)]);
 }
Beispiel #20
0
 /**
  * Add a new entry in the admin tools menu
  *
  * should add to event a fragment with fields : id,class,url,title
  *
  * @param HookRenderBlockEvent $event
  */
 public function onMainTopMenuTools(HookRenderBlockEvent $event)
 {
     $event->add(['id' => 'tools_menu_carousel', 'class' => '', 'url' => URL::getInstance()->absoluteUrl('/admin/module/Carousel'), 'title' => $this->trans('Edit your carousel', [], Carousel::DOMAIN_NAME)]);
 }
Beispiel #21
0
 /**
  * Add a link to the pop-in configuration page in the tools menu.
  * @param HookRenderBlockEvent $event
  */
 public function onMainTopMenuTools(HookRenderBlockEvent $event)
 {
     $event->add(['title' => $this->trans('Pop-in campaigns', [], PopIn::MESSAGE_DOMAIN_BO), 'url' => $this->router->generate('popin.config')]);
 }
 public function onMainTopMenuTools(HookRenderBlockEvent $event)
 {
     $event->add(["title" => $this->trans("Edit stylesheet", [], BackOfficeCss::MESSAGE_DOMAIN), "url" => URL::getInstance()->absoluteUrl("/admin/module/BackOfficeCss")]);
 }