Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions config/allowed_files.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
'composer.lock',
'config/allowed_files.php',
'config/index.php',
'config/routes.yml',
'config/services.yml',
'controllers/admin/AdminEverBlockConfigurationController.php',
'controllers/admin/AdminEverBlockController.php',
Expand Down Expand Up @@ -99,6 +100,14 @@
'src/Command/PrettyBlocksCommand.php',
'src/Command/SearchReplaceCommand.php',
'src/Command/index.php',
'src/Controller/Admin/EverblockConfigurationController.php',
'src/Controller/Admin/index.php',
'src/Controller/index.php',
'src/Form/Type/EverblockConfigurationType.php',
'src/Form/Type/index.php',
'src/Form/index.php',
'src/Service/Configuration/EverblockConfigurationManager.php',
'src/Service/Configuration/index.php',
'src/Service/EverblockCache.php',
'src/Service/EverblockPrettyBlocks.php',
'src/Service/EverblockPreviewBuilder.php',
Expand Down Expand Up @@ -198,6 +207,8 @@
'views/img/svg/package.svg',
'views/img/svg/percent.svg',
'views/img/svg/phone.svg',
'views/templates/admin/symfony/configuration.html.twig',
'views/templates/admin/symfony/index.php',
'views/img/svg/pinterest.svg',
'views/img/svg/plus.svg',
'views/img/svg/qr.svg',
Expand Down
7 changes: 7 additions & 0 deletions config/routes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
everblock_admin_configuration:
path: /everblock/configuration
methods: [GET, POST]
defaults:
_controller: 'Everblock\\Tools\\Controller\\Admin\\EverblockConfigurationController::index'
_legacy_controller: AdminEverBlockConfiguration
_legacy_link: AdminEverBlockConfiguration
14 changes: 13 additions & 1 deletion config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ services:
autowire: true
autoconfigure: true

Everblock\Tools\Controller\:
resource: '../src/Controller'
public: true
tags: ['controller.service_arguments']

Everblock\Tools\Form\:
resource: '../src/Form'
public: true

Everblock\Tools\Service\Configuration\:
resource: '../src/Service/Configuration'
public: true

everblock.tools.import:
class: Everblock\Tools\Command\ImportFileCommand
public: true
Expand Down Expand Up @@ -44,4 +57,3 @@ services:
public: true
tags:
- { name: 'console.command' }

68 changes: 68 additions & 0 deletions src/Controller/Admin/EverblockConfigurationController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php

declare(strict_types=1);

/**
* 2019-2025 Team Ever
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author Team Ever <https://www.team-ever.com/>
* @copyright 2019-2025 Team Ever
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

namespace Everblock\Tools\Controller\Admin;

use Everblock\Tools\Form\Type\EverblockConfigurationType;
use Everblock\Tools\Service\Configuration\EverblockConfigurationManager;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Contracts\Translation\TranslatorInterface;

class EverblockConfigurationController extends AbstractController
{
private EverblockConfigurationManager $configurationManager;
private TranslatorInterface $translator;

public function __construct(EverblockConfigurationManager $configurationManager, TranslatorInterface $translator)
{
$this->configurationManager = $configurationManager;
$this->translator = $translator;
}

public function index(Request $request): Response
{
$configuration = $this->configurationManager->getConfiguration();

$form = $this->createForm(EverblockConfigurationType::class, $configuration);
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
$this->configurationManager->updateFromForm($form->getData());
$this->addFlash(
'success',
$this->translator->trans('Configuration updated successfully.', [], 'Modules.Everblock.Admin')
);

return $this->redirectToRoute('everblock_admin_configuration');
}

return $this->render(
'@Modules/everblock/views/templates/admin/symfony/configuration.html.twig',
[
'form' => $form->createView(),
'configuration' => $configuration,
]
);
}
}
29 changes: 29 additions & 0 deletions src/Controller/Admin/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/**
* 2019-2025 Team Ever
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author Team Ever <https://www.team-ever.com/>
* @copyright 2019-2025 Team Ever
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');

header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');

header('Location: ../');
exit;
29 changes: 29 additions & 0 deletions src/Controller/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/**
* 2019-2025 Team Ever
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author Team Ever <https://www.team-ever.com/>
* @copyright 2019-2025 Team Ever
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');

header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');

header('Location: ../');
exit;
83 changes: 83 additions & 0 deletions src/Form/Type/EverblockConfigurationType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php

declare(strict_types=1);

/**
* 2019-2025 Team Ever
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author Team Ever <https://www.team-ever.com/>
* @copyright 2019-2025 Team Ever
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

namespace Everblock\Tools\Form\Type;

use PrestaShopBundle\Form\Admin\Type\TranslateType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Symfony\Component\Validator\Constraints\NotBlank;

class EverblockConfigurationType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('pages_base_url', TextType::class, [
'label' => 'Pages base URL',
'help' => 'Base path used for the guide pages routes.',
'constraints' => [
new NotBlank(),
],
])
->add('pages_per_page', IntegerType::class, [
'label' => 'Items per page',
'help' => 'Number of guides to display on the listing page.',
'constraints' => [
new NotBlank(),
new GreaterThan(0),
],
])
->add('faq_base_url', TextType::class, [
'label' => 'FAQ base URL',
'help' => 'Base path used for the FAQ tag routes.',
'constraints' => [
new NotBlank(),
],
])
->add('faq_per_page', IntegerType::class, [
'label' => 'FAQ per page',
'help' => 'Number of FAQs to display for each tag page.',
'constraints' => [
new NotBlank(),
new GreaterThan(0),
],
])
->add('google_reviews_cta_label', TranslateType::class, [
'label' => 'Google reviews CTA label',
'type' => TextType::class,
'help' => 'Label used for the Google reviews call-to-action button.',
'required' => false,
]);
}

public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => null,
]);
}
}
29 changes: 29 additions & 0 deletions src/Form/Type/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/**
* 2019-2025 Team Ever
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author Team Ever <https://www.team-ever.com/>
* @copyright 2019-2025 Team Ever
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');

header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');

header('Location: ../');
exit;
29 changes: 29 additions & 0 deletions src/Form/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/**
* 2019-2025 Team Ever
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author Team Ever <https://www.team-ever.com/>
* @copyright 2019-2025 Team Ever
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');

header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');

header('Location: ../');
exit;
Loading
Loading