Adding Customer Custom attributes creating document files#446
Conversation
| @@ -0,0 +1,419 @@ | |||
| --- | |||
| title: Add a Custom boolean Field Attribute | Commerce PHP Extensions | |||
There was a problem hiding this comment.
boolean should be capitalised. Should be:
title: Add a Custom Boolean Field Attribute | Commerce PHP Extensions
| The factory is stored rather than a single `CustomerSetup` instance, because both `apply()` and `revert()` need to create their own instance. | ||
|
|
||
| ```php | ||
| <?php declare(strict_types=1); |
There was a problem hiding this comment.
This snippet is a method-level excerpt, not a complete PHP file. The <?php declare(strict_types=1); opening tag should not appear here — it is only appropriate at the top of a full file. Please remove this line from the snippet.
| ### Code reference | ||
|
|
||
| ```php | ||
| <?php declare(strict_types=1); |
There was a problem hiding this comment.
<?php and declare(strict_types=1); must each be on their own line, consistently across the document.
| @@ -0,0 +1,412 @@ | |||
| --- | |||
| title: Add a Custom dropdown Field Attribute | Commerce PHP Extensions | |||
There was a problem hiding this comment.
dropdown should be capitalised. Should be:
title: Add a Custom Dropdown Field Attribute | Commerce PHP Extensions
|
|
||
|  | ||
|
|
||
| To remove the attribute, run `bin/magento setup:rollback` and target this patch. The `revert()` method will execute and delete the attribute from the system. |
There was a problem hiding this comment.
<?php and declare(strict_types=1); must each be on their own line, consistently across the document.
| @@ -0,0 +1,416 @@ | |||
| --- | |||
| title: Add a Custom boolean Field Attribute | Commerce PHP Extensions | |||
There was a problem hiding this comment.
The title says boolean — copied from the boolean file and not updated. Should be:
title: Add a Custom Multiselect Field Attribute | Commerce PHP Extensions
| @@ -0,0 +1,416 @@ | |||
| --- | |||
| title: Add a Custom boolean Field Attribute | Commerce PHP Extensions | |||
| description: Follow this tutorial to create a custom boolean field attribute for Adobe Commerce or Magento Open Source. | |||
There was a problem hiding this comment.
The description also says boolean field attribute — copied from the boolean file and not updated. Should be:
description: Follow this tutorial to create a custom multiselect field attribute for Adobe Commerce or Magento Open Source.
|
|
||
| This tutorial describes how a developer can create a custom multiselect attribute for the Customer entity using code. This will reflect in both the [Customer Grid](https://experienceleague.adobe.com/en/docs/commerce-admin/customers/customer-accounts/manage/manage-account) and the [Customer Form](https://experienceleague.adobe.com/en/docs/commerce-admin/customers/customer-accounts/manage/update-account) in the Admin. | ||
|
|
||
| Use a multiselect attribute when you need to store multiple simultaneous values for a single customer field — for example, eligible shipping methods, allowed sales channels, or subscription preferences. Unlike the [dropdown attribute](custom-dropdown-attribute.md), which stores a single selected option ID as an integer, a multiselect attribute stores a comma-separated list of option IDs as a `varchar` value, handled by the `ArrayBackend` backend model. This tutorial also implements `PatchRevertableInterface`, which allows the attribute to be cleanly removed by running `bin/magento setup:rollback`. |
There was a problem hiding this comment.
Broken internal link: custom-dropdown-attribute.md does not exist in this PR — the dropdown file is named custom-dropdown-field-attribute.md. This will resolve automatically if the file naming issue is fixed by removing -field- from all filenames.
| ### Code reference | ||
|
|
||
| ```php | ||
| <?php declare(strict_types=1); |
There was a problem hiding this comment.
<?php and declare(strict_types=1); must each be on their own line, consistently across the document.
| $this->moduleDataSetup->getConnection()->endSetup(); | ||
| } | ||
| } | ||
| ``` No newline at end of file |
There was a problem hiding this comment.
File is missing a trailing newline character. This will cause a MD047/single-trailing-newline markdownlint failure in CI. Please add a newline after the closing code fence.
There was a problem hiding this comment.
Added new line et the end of the php snippet
|
Implemented all changes as per the comments |
Co-authored-by: Thiaramus <thiaramus@icloud.com>
Co-authored-by: Thiaramus <thiaramus@icloud.com>
Co-authored-by: Thiaramus <thiaramus@icloud.com>
Purpose of this pull request
This pull request adds tutorials for 3 additional custom customer attribute types (boolean, dropdown, and multiselect) to the Adobe Commerce PHP documentation.
Key Changes
/src/pages/config.mdto include navigation links to all three new tutorial pagesNew Topics & Documentation Pages
whatsnew
Add tutorials showing how to extend Adobe Commerce customer attributes with three commonly-used field types, providing developers with step-by-step code implementations, dependency injection patterns, and data patch lifecycle management (including reversible rollback functionality):