Skip to content

Commit

Permalink
php-cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
PrestaSafe committed Feb 2, 2024
1 parent 5194b3d commit 69ea18b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 24 deletions.
14 changes: 4 additions & 10 deletions prettyblocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
*/
use PrestaSafe\PrettyBlocks\Core\Components\Title;
use PrestaShop\PrestaShop\Core\Module\WidgetInterface;
use PrestaShop\PrestaShop\Adapter\SymfonyContainer;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

if (!defined('_PS_VERSION_')) {
exit;
Expand Down Expand Up @@ -160,14 +158,11 @@ public function getContent()
private function getPrettyBlocksUrl()
{
$domain = Tools::getShopDomainSsl(true);

return $domain . Link::getUrlSmarty([
'entity' => 'sf',
'route' => 'admin_prettyblocks',

]);


}

private function loadDefault()
Expand All @@ -177,15 +172,14 @@ private function loadDefault()

public function hookdisplayBackOfficeHeader($params)
{
$route = (new \Link())->getAdminLink('AdminThemeManagerControllerRouteGenerator');
$route = (new Link())->getAdminLink('AdminThemeManagerControllerRouteGenerator');
Media::addJsDef([
'prettyblocks_route_generator' => $route,
'prettyblocks_logo' => HelperBuilder::pathFormattedToUrl('$/modules/prettyblocks/logo.png'),
]);

$this->context->controller->addJS($this->_path.'views/js/back.js');
}

$this->context->controller->addJS($this->_path . 'views/js/back.js');
}

public function install()
{
Expand Down
24 changes: 10 additions & 14 deletions src/Controller/AdminThemeManagerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,17 @@ public function indexAction()
// url to load at startup : provided url or shop home page
$startup_url = \Tools::getValue('startup_url', $shop_url);

if(\Tools::getValue('endpoint')){
switch(\Tools::getValue('endpoint'))
{
if (\Tools::getValue('endpoint')) {
switch (\Tools::getValue('endpoint')) {
case 'product':
$startup_url = $link->getProductLink((int)\Tools::getValue('id'));
break;
$startup_url = $link->getProductLink((int) \Tools::getValue('id'));
break;
case 'category':
$startup_url = $link->getCategoryLink((int)\Tools::getValue('id'));
break;
$startup_url = $link->getCategoryLink((int) \Tools::getValue('id'));
break;
case 'cms':
$startup_url = $link->getCMSLink((int)\Tools::getValue('id'));
break;
$startup_url = $link->getCMSLink((int) \Tools::getValue('id'));
break;
}
}

Expand Down Expand Up @@ -631,23 +630,20 @@ protected function getLangLink($idLang = null, \Context $context = null, $idShop
return \Language::getIsoById($idLang) . '/';
}


public function routeGeneratorAction(Request $request)
{
$posts = json_decode($request->getContent(), true);
$endpoint = $posts['endpoint'];
$id = (int)$posts['id'];
$id = (int) $posts['id'];

$router = $this->get('router');
$url = $router->generate('admin_prettyblocks', [
'endpoint' => $endpoint,
'id' => $id,
]);

return (new JsonResponse())->setData([
'url' => $url,
]);


}

}

0 comments on commit 69ea18b

Please sign in to comment.