Skip to content

Commit

Permalink
Improved the module compatibility with 1.7.5 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Mickaël Andrieu committed Apr 30, 2019
1 parent f2aa659 commit 8460421
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 200 deletions.
2 changes: 1 addition & 1 deletion .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$finder = PhpCsFixer\Finder::create()->in([
__DIR__.'/src',
__DIR__.'/tests',
'training.php'
'.'
]);

return PhpCsFixer\Config::create()
Expand Down
4 changes: 1 addition & 3 deletions config/services.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
parameters:
exchange_rates_api_endpoint: 'https://api.exchangeratesapi.io/latest'

services:
_defaults:
Expand Down Expand Up @@ -32,7 +31,6 @@ services:
class: 'PrestaShop\Training\Grid\Definition\ProductGridDefinitionFactory'
parent: 'prestashop.core.grid.definition.factory.abstract_grid_definition'
arguments:
- '@prestashop.core.hook.dispatcher'
- "@=service('router').generate('admin_common_reset_search', {'controller': 'product', 'action': 'listing'})"
- "@=service('router').generate('admin_ps_training_products')"
public: true
Expand Down Expand Up @@ -74,4 +72,4 @@ services:

ps_training.tab_manager:
class: 'PrestaShop\Training\Menu\TabManager'
tags: ['front']
tags: ['front']
12 changes: 12 additions & 0 deletions config_fr.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>training</name>
<displayName><![CDATA[PrestaShop Training module]]></displayName>
<version><![CDATA[1.0.1]]></version>
<description><![CDATA[Demonstrate all the features of the PrestaShop Back Office, in its version 1.7.5]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[]]></tab>
<is_configurable>0</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>
3 changes: 2 additions & 1 deletion src/Command/ShopStatusCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

/**
* @param array $shops the list of the shops
*
* @return array
*/
private function formatShopInformation(array $shops)
Expand All @@ -81,7 +82,7 @@ private function formatShopInformation(array $shops)
$shop->getName(),
$shop->getThemeName(),
$shop->getActive() ? '' : '',
$shop->getDeleted() ? '' : ''
$shop->getDeleted() ? '' : '',
];
}

Expand Down
32 changes: 0 additions & 32 deletions src/Currency/CurrencyRateUpdaterInterface.php

This file was deleted.

78 changes: 0 additions & 78 deletions src/Currency/ExchangeRatesCurrencyRateUpdater.php

This file was deleted.

33 changes: 0 additions & 33 deletions src/Currency/RateNotFoundException.php

This file was deleted.

5 changes: 1 addition & 4 deletions src/Grid/Definition/ProductGridDefinitionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use PrestaShop\PrestaShop\Core\Grid\Filter\Filter;
use PrestaShop\PrestaShop\Core\Grid\Filter\FilterCollection;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use PrestaShop\PrestaShop\Core\Hook\HookDispatcherInterface;
use PrestaShop\Training\Grid\FormType\YesAndNoChoiceType;
use PrestaShopBundle\Form\Admin\Type\SearchAndResetType;
use PrestaShop\Training\Grid\Column\LinkColumn;
Expand All @@ -38,12 +37,10 @@ final class ProductGridDefinitionFactory extends AbstractGridDefinitionFactory
* @param string $resetFiltersUrl
* @param string $redirectUrl
*/
public function __construct(HookDispatcherInterface $hookDispatcher, $resetFiltersUrl, $redirectUrl)
public function __construct($resetFiltersUrl, $redirectUrl)
{
$this->resetFiltersUrl = $resetFiltersUrl;
$this->redirectUrl = $redirectUrl;

parent::__construct($hookDispatcher);
}

/**
Expand Down
56 changes: 56 additions & 0 deletions src/Grid/Logs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

namespace PrestaShop\Training\Grid;

use PrestaShop\PrestaShop\Core\Grid\Column\Type\DataColumn;
use PrestaShop\PrestaShop\Core\Grid\Definition\GridDefinitionInterface;
use PrestaShop\PrestaShop\Core\Grid\Filter\Filter;
use Symfony\Component\Form\Extension\Core\Type\TextType;

/**
* Stores all the customizations done in the Logs Grid of the Back Office.
*/
final class Logs
{
/**
* This moves the column "Object Type" after the "Error Code" one.
* No need to touch any template for that!
*
* @param GridDefinitionInterface $definition
*/
public static function moveObjectTypeAfterErrorColumn(GridDefinitionInterface $definition)
{
$definition->getColumns()
->remove('object_type')
->addAfter(
'error_code',
(new DataColumn('object_type'))
->setName('Object Type')
->setOptions([
'field' => 'object_type',
])
)
;
}

/**
* You can update the Filter Form of any grid.
* See @doc https://symfony.com/doc/3.4/components/form.html for all available options.
*
* @param GridDefinitionInterface $definition
*/
public static function updateObjectTypeFilterForm(GridDefinitionInterface $definition)
{
$definition->getFilters()
->remove('message')
->add((new Filter('message', TextType::class))
->setAssociatedColumn('message')
->setTypeOptions([
'attr' => [
'placeholder' => 'This field accepts regular expressions.',
],
])
)
;
}
}
2 changes: 1 addition & 1 deletion src/Product/AlternativeDescription.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static function removeToProductTable()
* @param $productId
* @param FormFactoryInterface $formFactory
*
* @return \Symfony\Component\Form\FormFactoryInterface
* @return FormInterface
*/
public static function addToForm($productId, FormFactoryInterface $formFactory)
{
Expand Down
Loading

0 comments on commit 8460421

Please sign in to comment.