You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
│ │ └── webpack_encore.yaml # Webpack Encore configuration
28
33
│ ├── routes.yaml # Route definitions including catch-all route
29
34
│ └── services.yaml # Service definitions including DotCMS client
35
+
├── public/
36
+
│ └── build/ # Compiled assets (generated by Webpack Encore)
30
37
├── src/
31
38
│ ├── Controller/
32
39
│ │ └── CatchAllController.php # Handles all DotCMS page requests
33
40
│ ├── Service/
34
41
│ │ └── DotCMSService.php # Wrapper for DotCMS PHP SDK
35
42
│ └── Twig/
36
43
│ └── DotCMSExtension.php # Twig extensions for DotCMS rendering
37
-
└── templates/
38
-
├── base.html.twig # Base template
39
-
├── page.html.twig # Main page template
40
-
└── dotcms/ # DotCMS-specific templates
41
-
├── container.twig # Container template
42
-
├── header.twig # Header template
43
-
└── content-types/ # Content type templates
44
-
├── banner.twig
45
-
├── product.twig
46
-
└── activity.twig
44
+
├── templates/
45
+
│ ├── base.html.twig # Base template
46
+
│ ├── page.html.twig # Main page template
47
+
│ └── dotcms/ # DotCMS-specific templates
48
+
│ ├── container.twig # Container template
49
+
│ ├── header.twig # Header template
50
+
│ └── content-types/ # Content type templates
51
+
│ ├── banner.twig
52
+
│ ├── product.twig
53
+
│ └── activity.twig
54
+
├── package.json # Node.js dependencies and build scripts
55
+
└── webpack.config.js # Webpack Encore configuration
47
56
```
48
57
49
58
## Using SDK Utilities
@@ -96,19 +105,39 @@ symfony new my-dotcms-project
96
105
cd my-dotcms-project
97
106
```
98
107
99
-
2. Install the DotCMS PHP SDK:
108
+
2. Install the DotCMS PHP SDK and required dependencies:
100
109
101
110
```bash
102
111
composer require dotcms/php-sdk
112
+
composer require symfony/webpack-encore-bundle
103
113
```
104
114
105
-
3. Configure your DotCMS connection in `.env`:
115
+
3. Install Node.js dependencies:
116
+
117
+
```bash
118
+
npm install
119
+
```
120
+
121
+
4. Configure your DotCMS connection in `.env`:
106
122
107
123
```
108
124
DOTCMS_HOST=https://demo.dotcms.com
109
125
DOTCMS_API_KEY=your-api-key-here
110
126
```
111
127
128
+
5. Build frontend assets:
129
+
130
+
```bash
131
+
# For development
132
+
npm run dev
133
+
134
+
# For production
135
+
npm run build
136
+
137
+
# For development with file watching
138
+
npm run watch
139
+
```
140
+
112
141
### Using Local SDK Development Setup
113
142
114
143
If you want to test the Symfony example with a local version of the PHP SDK (for development or testing new changes), you can use the `composer.dev.json` configuration:
@@ -519,7 +548,40 @@ To add support for a new content type:
519
548
520
549
### Styling
521
550
522
-
The project includes a basic grid system in `assets/styles/app.css` and uses [Pico.css](https://picocss.com/) for base styling. You can customize these styles or replace them with your preferred CSS framework.
551
+
The project uses [Pico.css](https://picocss.com/) for base styling and includes a basic grid system. Assets are managed by Webpack Encore, allowing you to:
552
+
553
+
- Add CSS/SCSS files to the `assets/styles/` directory
554
+
- Import styles in your JavaScript files
555
+
- Use CSS frameworks like Bootstrap, Tailwind, etc.
556
+
- Leverage Webpack's asset optimization features
557
+
558
+
To add new styles:
559
+
560
+
1. Create CSS/SCSS files in `assets/styles/`
561
+
2. Import them in `assets/app.js`
562
+
3. Run `npm run dev` to compile
563
+
564
+
### Frontend Architecture
565
+
566
+
The project uses Stimulus for JavaScript functionality:
567
+
568
+
- **Stimulus Controllers**: Located in `assets/controllers/`
569
+
- **DotCMS UVE Integration**: The `dotcms_edit_controller.js` provides content editing capabilities
570
+
- **Build Process**: Webpack Encore handles asset compilation and optimization
571
+
572
+
### UVE (Universal Visual Editor) Integration
573
+
574
+
The project includes DotCMS UVE integration for content editing:
575
+
576
+
- **Edit Mode**: Content editors can edit contentlets directly in the frontend
577
+
- **Stimulus Controller**: `dotcms_edit_controller.js` handles the edit functionality
578
+
- **Dependencies**: Uses `@dotcms/uve` and `@dotcms/types` packages
579
+
- **Automatic Detection**: Edit buttons only appear when in UVE edit mode
0 commit comments