Skip to content

Commit

Permalink
Merge pull request #1762 from thomasnares/FormsDocArrangement
Browse files Browse the repository at this point in the history
Cross linking for Forms subjects
  • Loading branch information
kpodemski authored Dec 28, 2023
2 parents dfbb062 + 3aee395 commit 0dfe7bf
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
12 changes: 12 additions & 0 deletions development/architecture/migration-guide/forms/CRUD-forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ weight: 20

# CRUD Forms

{{% notice tip %}}
If you are looking to customize an identifiable object with a module, please have a look at [Grid and identifiable object form hooks usage example]({{<relref "/8/modules/sample-modules/grid-and-identifiable-object-form-hooks-usage">}}).
{{% /notice %}}

{{% notice tip %}}
If you are looking for the Form component documentation, please have a look at [Forms with Symfony]({{<relref "/8/development/components/form">}}).
{{% /notice %}}

{{% notice tip %}}
This guide is intended for core developers and contributors who want to understand how PrestaShop handles forms in the core.
{{% /notice %}}

## Introduction

In computer programming, _CRUD_ is an acronym for the four basic functions of persistent storage: **create, read, update, and delete**.
Expand Down
4 changes: 2 additions & 2 deletions development/architecture/migration-guide/forms/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ PrestaShop provides some built-in Form types that will help you integrate the sp
* `TextWithUnitType`
* ...

Reference of existing [back office form types can be found here]({{<relref "/8/modules/creation/adding-configuration-page-modern#other-form-types">}}).
Reference of existing [back office form types can be found here]({{<relref "/8/development/components/form/types-reference/">}}).

Most of the components from the PrestaShop UI Kit are implemented as Form Types.

{{% notice note %}}
Before creating a new form type, check this folder first to see if the type already exists.
Before creating a new form type, check in the reference or in `src/PrestaShopBundle/Form/Admin/Type` folder first to see if the type already exists.
{{% /notice %}}

Forms are created and declared [as services](https://symfony.com/doc/4.4/form/form_dependencies.html) that you can use inside your Controllers – this is covered in the [Controllers/Routing section]({{< relref "/8/development/architecture/migration-guide/controller-routing" >}}) of this guide.
Expand Down
2 changes: 2 additions & 0 deletions development/components/form/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ The `FormBuilder` will build the required `Form` with all `Form Types`, and retr

The FormDataProvider is responsible for retrieving data from the Database. This data is used to populate the form when editing an existing entity. Additionally, it provides default values for the form fields, both when creating a new entity and when editing an existing one.

[Learn more about CRUD forms and FormDataProviders]({{<relref "/8/development/architecture/migration-guide/forms/CRUD-forms#creating-a-form-data-provider">}}).

### Form Types

Developers have access to a wide range of field types ([see Symfony types](https://symfony.com/doc/4.4/reference/forms/types.html)) that come from the Symfony framework. Additionally, PrestaShop enhances this selection with its own reusable field types.
Expand Down
5 changes: 3 additions & 2 deletions modules/concepts/forms/admin-forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ weight: 4
One of the most common tasks for the PrestaShop developers is to alter the data and make it manageable for customers.
In PrestaShop 1.6, a specific Form framework was created to help developers. In PrestaShop 1.7, the system has changed as we now rely on the Symfony Form component.

{{% notice warning %}}
{{% notice info %}}
**This system only works with pages from the "Configure" section of your back office.**

If you want to customize an entity form, you're looking for Grid and identifiable object form hooks usage example.
If you want to customize an entity form, you're looking for [Grid]({{<relref "8/development/components/grid/" >}}) and [Identifiable Objects]({{<relref "/8/development/architecture/migration-guide/forms/crud-forms">}}).

Learn how to achieve this with the [Grid and identifiable object form hooks usage example]({{<relref "/8/modules/sample-modules/grid-and-identifiable-object-form-hooks-usage">}}).
{{% /notice %}}

Let's see an example on how to add, populate, validate and persist a new form field in PrestaShop 1.7.
Expand Down

0 comments on commit 0dfe7bf

Please sign in to comment.