Skip to content

Commit

Permalink
Merge branch '8.x' into customizeCrud
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasnares authored Oct 30, 2023
2 parents 77583ab + 80ef7ff commit 7a98569
Show file tree
Hide file tree
Showing 380 changed files with 5,379 additions and 7,744 deletions.
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,57 @@ The deployment pipeline is documented on the [sources repository for DevDocs](ht
## License

Content from this documentation is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/).

## Maintaining Hook list referential

A complete referential of hook and informations on each hook is located in `modules/concepts/hooks/list-of-hooks/`.

This referential can be generated with a script, crawling all:

- PrestaShop (core) codebase
- all native modules
- all native themes

In the documentation, a hook is described in yaml format:

```yaml
---
Title: string #name of the hook
hidden: boolean[true] #must be true
hookTitle: string #title for the description
description: string #description sentence
origin: string #core, module or theme
files:
-
theme: string #theme name only if origin=theme
module: string #module name only if origin=module
url: string #url of the file on github
file: string #path of the file
locations:
- string #back office, front office or both
type: string #action or display
hookAliases:
- string #old hook name or alias
array_return: boolean #true or false if the hook has an `$array_return` parameter set to `true`
check_exceptions: boolean #true or false if the hook has a `$check_exceptions` parameter set to `false`
chain: boolean #true or false if the hook has a `$chain` parameter set to `true`
---
```

This YAML structure enables the shortcode `hookDescriptor` to generate an HTML page with condensed information for documentation, and allows the search script to search within this metadata.

Next, add the shortcode in the page's content:

```
{{% hookDescriptor %}}
```

Finally, if available, add a section with a code example and parameters details:

```
## Parameters details
[...]
## Call of the Hook in the origin file
[...]
```
2 changes: 1 addition & 1 deletion basics/installation/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ PrestaShop comes in two "flavors":
- **Release package**. A zip package, tuned for production environments.
- **Development version**. The raw source code as it is on the GitHub repository, including automated test suites, build scripts and source codes for assets that are otherwise compiled (like javascript and css files).

![Download files](../img/Prestashop_1.7.8.6_release.png)
![Download files](img/Prestashop_1.7.8.6_release.png)

{{% notice tip %}}
**Prefer cloning the repository using git for the development version.**
Expand Down
8 changes: 4 additions & 4 deletions development/components/database/db.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The first call to this method initializes the link to the database, and return t
In some cases, you might encounter this alternative:

```php
$db = Db::getInstance(_PS_USE_SQL_SLAVE_);
$db = \Db::getInstance(_PS_USE_SQL_SLAVE_);
```

If PrestaShop's database user allows the use of MySQL slave servers in its architecture, then this last instance's connection can be done on the slave servers.
Expand Down Expand Up @@ -56,7 +56,7 @@ It should only be used for read only queries: SELECT, SHOW, etc.
Using getRow() method will retrieve the first row of your query:

```php
$request = "SELECT `id_table` FROM `' . _DB_PREFIX_ . 'some_table` ...";
$request = 'SELECT `id_table` FROM `' . _DB_PREFIX_ . 'some_table` ...';

/** @var array $result */
$result = $db->getRow($request);
Expand All @@ -70,7 +70,7 @@ This function automatically adds "LIMIT 1" to the query.
#### Retrieving only a single value

```php
$request = "SELECT `count('sales')` FROM `' . _DB_PREFIX_ . 'some_table` ...";
$request = 'SELECT `count('sales')` FROM `' . _DB_PREFIX_ . 'some_table` ...';

/** @var string|false $salesCount */
$salesCount = $db->getValue($request);
Expand Down Expand Up @@ -103,7 +103,7 @@ Returns the number of rows impacted by the latest `INSERT`, `UPDATE`, `REPLACE`
### Execute a raw SQL request (UPDATE, INSERT...)

```php
$request = "INSERT INTO `' . _DB_PREFIX_ . 'some_table` (`id_table`) VALUES (10)";
$request = 'INSERT INTO `' . _DB_PREFIX_ . 'some_table` (`id_table`) VALUES (10)';

/** @var bool $result */
$result = $db->execute($request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ PrestaShop uses Symfony's [Translator Component](https://symfony.com/doc/4.4/tra

This component is initialized for the configured language by loading five Catalogue Resources:

* **Customized translations database** - Located in the `ps_translations` table.
* **Customized translations database** - Located in the `ps_translation` table.
* **Active theme** – XLF files in `./themes/<themename>/translations`.
* **Core** – XLF files in `./translations`.
* **Active modules** – XLF files in `./modules/<modulename>/translations`.
Expand Down
9 changes: 6 additions & 3 deletions development/naming-conventions/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ services:
### Named arguments
**Do NOT** use "named argument" syntax in service declaration:
**Do NOT** use "named argument" syntax in your front services declaration:
```yaml
services:
Expand All @@ -206,9 +205,13 @@ services:
wrong_foo_bar:
class: 'Foo\Bar'
arguments:
- $baz: 'baz'
$baz: 'baz'
```
If you do try to use named arguments in your front services definition you will end up with the following error:
> Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\RuntimeException: Invalid service "wrong_foo_bar": class "Foo\Bar" does not exist.
## Grid
PrestaShop comes with a lot of Grids (Products, Customers, Orders & etc) and keeping consistency between them is very important, thats why it follows these naming conventions:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
---
menuTitle: action<ClassName><Action>After
Title: action<ClassName><Action>After
hidden: true
hookTitle:
files:
- classes/controller/AdminController.php
-
url: 'https://github.com/PrestaShop/PrestaShop/blob/8.0.x/classes/controller/AdminController.php'
file: classes/controller/AdminController.php
locations:
- back office
- 'back office'
type: action
hookAliases:
---

# Hook action&lt;ClassName>&lt;Action>After

## Information
hookAliases:
array_return: false
check_exceptions: false
chain: false
origin: core
description: ''

Hook locations:
- back office

Hook type: action
---

Located in:
- [classes/controller/AdminController.php](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/classes/controller/AdminController.php)
{{% hookDescriptor %}}

## Call of the Hook in the origin file

```php
Hook::exec('action' . get_class($this) . ucfirst($this->action) . 'After', ['controller' => $this, 'return' => $return]);
```
```
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
---
menuTitle: action<ClassName><Action>Before
Title: action<ClassName><Action>Before
hidden: true
hookTitle:
files:
- classes/controller/AdminController.php
-
url: 'https://github.com/PrestaShop/PrestaShop/blob/8.0.x/classes/controller/AdminController.php'
file: classes/controller/AdminController.php
locations:
- back office
- 'back office'
type: action
hookAliases:
---

# Hook action&lt;ClassName>&lt;Action>Before

## Information
hookAliases:
array_return: false
check_exceptions: false
chain: false
origin: core
description: ''

Hook locations:
- back office

Hook type: action
---

Located in:
- [classes/controller/AdminController.php](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/classes/controller/AdminController.php)
{{% hookDescriptor %}}

## Call of the Hook in the origin file

```php
Hook::exec('action' . get_class($this) . ucfirst($this->action) . 'Before', ['controller' => $this]);
```
```
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
---
menuTitle: action<Controller>FormModifier
Title: action<Controller>FormModifier
hidden: true
hookTitle:
files:
- classes/controller/AdminController.php
-
url: 'https://github.com/PrestaShop/PrestaShop/blob/8.0.x/classes/controller/AdminController.php'
file: classes/controller/AdminController.php
locations:
- back office
- 'back office'
type: action
hookAliases:
---

# Hook action&lt;Controller>FormModifier

## Information
hookAliases:
array_return: false
check_exceptions: false
chain: false
origin: core
description: ''

Hook locations:
- back office

Hook type: action
---

Located in:
- [classes/controller/AdminController.php](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/classes/controller/AdminController.php)
{{% hookDescriptor %}}

## Call of the Hook in the origin file

Expand All @@ -32,4 +29,4 @@ Hook::exec('action' . $this->controller_name . 'FormModifier', [
'fields_value' => &$fields_value,
'form_vars' => &$this->tpl_form_vars,
])
```
```
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
---
menuTitle: action<Controller>ListingFieldsModifier
Title: action<Controller>ListingFieldsModifier
hidden: true
hookTitle:
files:
- classes/controller/AdminController.php
-
url: 'https://github.com/PrestaShop/PrestaShop/blob/8.0.x/classes/controller/AdminController.php'
file: classes/controller/AdminController.php
locations:
- back office
- 'back office'
type: action
hookAliases:
---

# Hook action&lt;Controller>ListingFieldsModifier

## Information
hookAliases:
array_return: false
check_exceptions: false
chain: false
origin: core
description: ''

Hook locations:
- back office

Hook type: action
---

Located in:
- [classes/controller/AdminController.php](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/classes/controller/AdminController.php)
{{% hookDescriptor %}}

## Call of the Hook in the origin file

```php
Hook::exec('action' . $this->controller_name . 'ListingFieldsModifier', [
'fields' => &$this->fields_list,
])
```
```
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
---
menuTitle: action<Controller>ListingResultsModifier
Title: action<Controller>ListingResultsModifier
hidden: true
hookTitle:
files:
- classes/controller/AdminController.php
-
url: 'https://github.com/PrestaShop/PrestaShop/blob/8.0.x/classes/controller/AdminController.php'
file: classes/controller/AdminController.php
locations:
- back office
- 'back office'
type: action
hookAliases:
---

# Hook action&lt;Controller>ListingResultsModifier

## Information
hookAliases:
array_return: false
check_exceptions: false
chain: false
origin: core
description: ''

Hook locations:
- back office

Hook type: action
---

Located in:
- [classes/controller/AdminController.php](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/classes/controller/AdminController.php)
{{% hookDescriptor %}}

## Call of the Hook in the origin file

Expand All @@ -30,4 +27,4 @@ Hook::exec('action' . $this->controller_name . 'ListingResultsModifier', [
'list' => &$this->_list,
'list_total' => &$this->_listTotal,
])
```
```
Loading

0 comments on commit 7a98569

Please sign in to comment.