@@ -14,11 +14,62 @@ The ThemeBuilder architecture consists of the following components:
14142 . ** BuilderPool** : Manages the available builders and selects the appropriate builder for a theme
15153 . ** Concrete Builder Implementations** : Specialized builders for different theme types
1616
17+ ## Directory Structure for Your Custom Module
18+
19+ To create your own ThemeBuilder, you'll need to set up a custom Magento 2 module with the following structure:
20+
21+ ```
22+ app/code/YourCompany/YourModule/
23+ ├── Console/
24+ │ └── Command/
25+ │ └── [Optional custom commands]
26+ ├── Service/
27+ │ └── ThemeBuilder/
28+ │ └── YourBuilder/
29+ │ └── Builder.php
30+ ├── etc/
31+ │ ├── di.xml
32+ │ └── module.xml
33+ └── registration.php
34+ ```
35+
36+ This is a minimal structure for your module. You can add more files and directories as needed for your specific implementation.
37+
1738## Creating Your Own ThemeBuilder
1839
19- ### Step 1: Create a New Builder Class
40+ ### Step 1: Create the Module Structure
2041
21- Create a new class in one of your modules or in a custom MageForge plugin. The structure should look like this:
42+ First, create the basic module structure as shown above:
43+
44+ 1 . Create the module directory: ` app/code/YourCompany/YourModule/ `
45+ 2 . Create a registration.php file:
46+ ``` php
47+ <?php
48+ use Magento\Framework\Component\ComponentRegistrar;
49+
50+ ComponentRegistrar::register(
51+ ComponentRegistrar::MODULE,
52+ 'YourCompany_YourModule',
53+ __DIR__
54+ );
55+ ```
56+
57+ 3 . Create a module.xml file in the etc directory:
58+ ``` xml
59+ <?xml version =" 1.0" ?>
60+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
61+ xsi : noNamespaceSchemaLocation =" urn:magento:framework:Module/etc/module.xsd" >
62+ <module name =" YourCompany_YourModule" setup_version =" 1.0.0" >
63+ <sequence >
64+ <module name =" OpenForgeProject_MageForge" />
65+ </sequence >
66+ </module >
67+ </config >
68+ ```
69+
70+ ### Step 2: Create a New Builder Class
71+
72+ Create a new Builder class in ` app/code/YourCompany/YourModule/Service/ThemeBuilder/YourBuilder/Builder.php ` :
2273
2374``` php
2475<?php
@@ -121,9 +172,9 @@ class Builder implements BuilderInterface
121172}
122173```
123174
124- ### Step 2 : Register Your Builder in the DI System
175+ ### Step 3 : Register Your Builder in the DI System
125176
126- To make your builder available to MageForge, you need to register it in Magento's Dependency Injection system. Create a ` di.xml ` file in your module :
177+ Create a ` di.xml ` file in ` app/code/YourCompany/YourModule/etc/ ` :
127178
128179``` xml
129180<?xml version =" 1.0" ?>
@@ -139,6 +190,16 @@ To make your builder available to MageForge, you need to register it in Magento'
139190</config >
140191```
141192
193+ ### Step 4: Install and Enable Your Module
194+
195+ After creating all the required files, you need to enable your module:
196+
197+ 1 . Run ` bin/magento module:enable YourCompany_YourModule `
198+ 2 . Run ` bin/magento setup:upgrade `
199+ 3 . Run ` bin/magento cache:clean `
200+
201+ After these steps, your custom ThemeBuilder will be available and integrated with MageForge.
202+
142203## Implementation Details
143204
144205### The detect() Method
0 commit comments