Skip to content

Commit 9d25219

Browse files
committed
docs: fix typos, improve clarity and structure across plugin guides
1 parent 42ab8cd commit 9d25219

17 files changed

Lines changed: 173 additions & 152 deletions

guides/plugins/plugins/bundle.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Shopware plugins extend Symfony bundles and add:
2929
* Asset building integration
3030
* Administration management
3131

32-
Class hierarchy: Plugin → Shopware\Bundle → Symfony\Bundle
32+
Class hierarchy: `Plugin``Shopware\Bundle``Symfony\Bundle`
3333

3434
## When to use a bundle
3535

@@ -79,7 +79,7 @@ project-root/
7979
└── .shopware-project.yaml
8080
```
8181

82-
The Bundle is typically placed in a project's `src/` folder, which is the standard location for custom code. You still will need to register the Bundle in the project's `config/bundles.php` file.
82+
The Bundle is typically placed in a project's `src/` folder, which is the standard location for custom code. You will still need to register the Bundle in the project's `config/bundles.php` file.
8383

8484
## Choosing the right bundle class
8585

@@ -144,7 +144,7 @@ if (Feature::isActive('YOUR_FEATURE_FLAG') && InstalledVersions::isInstalled('ve
144144
You can add services, Twig templates, routes, etc., to your Bundle just as you would to a plugin. Create `Resources/config/services.php` and `Resources/config/routes.php` files, or `Resources/views` for Twig templates. The Bundle will be automatically detected, and the files will be loaded.
145145

146146
To mark your Bundle as a theme, you only need to implement the `Shopware\Core\Framework\ThemeInterface` interface in your bundle class.
147-
This will automatically register your Bundle as a theme and make it available in the Shopware administration.
147+
This will automatically register your Bundle as a theme and make it available in the Administration.
148148
You can also add a `theme.json` file to define the theme configuration like [described here](../themes/configuration/theme-configuration.md).
149149

150150
## Adding migrations
@@ -170,7 +170,7 @@ class YourBundleName extends Bundle
170170
}
171171
```
172172

173-
Since Bundles don't have a lifecycle, migrations aren't automatically executed. Execute them manually via the console command:
173+
Since bundles don't have a lifecycle, migrations aren't automatically executed. Execute them manually via the console command:
174174

175175
```bash
176176
bin/console database:migrate <BundleName> --all
@@ -193,11 +193,11 @@ The Shopware CLI cannot automatically detect bundles. Therefore, bundle assets a
193193
{
194194
"extra": {
195195
"shopware-bundles": {
196-
"src/<BundleName>": {
197-
"name": "<BundleName>",
198-
}
199-
}
200-
}
196+
"src/<BundleName>": {
197+
"name": "<BundleName>"
198+
}
199+
}
200+
}
201201
}
202202
```
203203

@@ -207,8 +207,8 @@ This will tell Shopware CLI where the Bundle is located and its name.
207207

208208
Now that you know about the differences between a Symfony bundle and a Shopware plugin, review the following guides:
209209

210-
* [Dependency Injection](../plugins/services/dependency-injection.md)
211-
* [Listening to events](../plugins/framework/event/listening-to-events.md)
210+
* [Dependency Injection](services/dependency-injection.md)
211+
* [Listening to events](framework/event/listening-to-events.md)
212212

213213
Also check out these useful videos:
214214

guides/plugins/plugins/creating-plugins.md

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@ nav:
55

66
---
77

8-
## Creating Plugins
8+
# Creating Plugins
99

1010
This guide walks you through creating and scaffolding a basic Shopware plugin so it can be installed locally on your Shopware 6 instance.
1111

12-
::: info
13-
Refer to this video on [Creating a plugin](https://www.youtube.com/watch?v=_Tkoq5W7woI) that shows how to bootstrap a plugin. Also available on our free online training ["Shopware 6 Backend Development"](https://academy.shopware.com/courses/shopware-6-backend-development-with-jisse-reitsma).
14-
:::
15-
1612
## Prerequisites
1713

1814
You'll need:
@@ -21,8 +17,6 @@ You'll need:
2117
* A running Shopware 6 instance; refer to our [Install Shopware 6](../../installation/index.md) guide
2218
* full file system and command line access
2319

24-
`<shopware project root>/custom/plugins` contains all plugins from the Shopware store. You install and manage these plugins via the Shopware Administration.
25-
2620
## 1. Choose a name
2721

2822
Use **UpperCamelCase**, which means that your plugin name must begin with a capital letter too. Whenever possible, begin it with a company prefix to avoid duplicate names (e.g., `SwagBasicExample`). Choose a name that describes your plugin as succinctly and clearly as possible.
@@ -33,6 +27,8 @@ A vendor prefix is required if you plan to publish your plugin in the [Shopware
3327

3428
## 2. Generate the plugin structure
3529

30+
Plugins are located in `<shopware project root>/custom/plugins` and managed via the Shopware Administration.
31+
3632
From your Shopware project's root directory, run:
3733

3834
```bash
@@ -93,7 +89,7 @@ This file contains basic metadata that Shopware needs to know about your plugin,
9389
* The technical name
9490
* The description
9591
* The author
96-
* The used license
92+
* The license
9793
* The current plugin version
9894
* The required dependencies
9995
* and other configuration details.
@@ -157,7 +153,7 @@ Here's an example `composer.json` you can refer to:
157153
If you change the `autoload.psr-4` path (for example, not using `src/`), adjust your directory structure accordingly.
158154
:::
159155

160-
::: Info
156+
::: info
161157
Set up [CI](../../development/testing/ci.md) early. Run static analysis, tests, and `shopware-cli extension build` in CI so your plugin ZIP is reproducible and safe to promote across environments.
162158
:::
163159

@@ -171,7 +167,7 @@ composer config repositories.shopware composer https://packages.shopware.com
171167

172168
Authentication via API token is required. Refer to ["Using Composer for plugin installation in Shopware"](https://www.shopware.com/en/news/using-composer-for-plugin-installation-in-shopware/) for detailed information.
173169

174-
### Manual creation (optional)
170+
## Manual creation (optional)
175171

176172
In most cases, you should use `bin/console plugin:create`. Manual creation is only useful if you need full control over the structure or are working in a custom setup.
177173

@@ -190,7 +186,7 @@ SwagBasicExample/
190186
└── SwagBasicExample.php
191187
```
192188

193-
* **namespace**: here, it's `Swag\BasicExample`. We recommend using a combination of your manufacturer prefix and the technical name to name it.
189+
* **Namespace**: here, it's `Swag\BasicExample`. We recommend using a combination of your manufacturer prefix and the technical name to name it.
194190
* **`src/` directory**: recommended but not strictly required.
195191
* **PHP class**: `SwagBasicExample.php`, which you name after your plugin.
196192

@@ -209,12 +205,6 @@ class SwagBasicExample extends Plugin
209205
}
210206
```
211207

212-
::: warning
213-
If you change the `autoload.psr-4` path (for example, not using `src/`), your directory structure must match that configuration.
214-
:::
215-
216-
And that's it. The basic structure and all necessary files for your plugin to be installable are done.
217-
218208
## Next steps
219209

220210
[Install and activate](./install-activate-plugin.md) your plugin.

guides/plugins/plugins/database/custom-fields-of-type-media.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ nav:
66

77
# Using Custom Fields of Type Media
88

9-
## Overview
10-
119
After adding a custom field of type media in the Administration or via a plugin, you can assign media objects to different entities.
1210
This is often used on products to add additional images to the product detail page.
13-
If you want to learn more about custom fields, take a look at [Adding custom fields](../framework/custom-field/add-custom-field.md).
11+
For more on custom fields, see [Adding custom fields](../framework/custom-field/add-custom-field.md).
1412

1513
## Resolve media custom fields in Twig
1614

@@ -21,10 +19,10 @@ In the product detail page template, `page.product.translated.customFields.xxx`
2119
public function searchMedia(array $ids, Context $context): MediaCollection { ... }
2220
```
2321

24-
This function resolves the corresponding media entities for the given IDs. Here is an example with a custom field \(`custom_sports_media_id`\) on the product detail page:
22+
This function resolves the corresponding media entities for the given IDs. Here is an example with a custom field (`custom_sports_media_id`) on the product detail page:
2523

2624
```twig
27-
// <plugin root>/src/Resources/views/storefront/page/content/product-detail.html.twig
25+
{# <plugin root>/src/Resources/views/storefront/page/content/product-detail.html.twig #}
2826
{% sw_extends '@Storefront/storefront/page/product-detail/index.html.twig' %}
2927
3028
{% block page_product_detail_media %}
@@ -48,10 +46,10 @@ After loading the entity, you can use fields like `sportsMedia.url`, `sportsMedi
4846
This function performs a database query on every invocation and should therefore not be used inside a loop.
4947
To resolve multiple IDs at once, pass them as one array.
5048

51-
To read the media objects within the product listing, we recommend the following procedure:
49+
To read the media objects within the product listing, use the following approach:
5250

5351
```twig
54-
// <plugin root>/src/Resources/views/storefront/component/product/listing.html.twig
52+
{# <plugin root>/src/Resources/views/storefront/component/product/listing.html.twig #}
5553
{% sw_extends '@Storefront/storefront/component/product/listing.html.twig' %}
5654
5755
{% block element_product_listing_col %}

guides/plugins/plugins/database/database-migrations.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ nav:
77

88
# Database Migrations
99

10-
## Overview
11-
12-
This guide covers what migrations are and how to use them.
13-
1410
Migrations are PHP classes used to manage incremental and reversible database schema changes. Shopware comes with a pre-built Migration System, to take away most of the work for you. Throughout this guide, you will find the `$` symbol representing your command line.
1511

1612
## Prerequisites
@@ -34,7 +30,7 @@ By default, Shopware 6 is looking for migration files in a directory called `Mig
3430
└── SwagBasicExample.php
3531
```
3632

37-
As you can see there is one file in the `<plugin root>/src/Migration` directory. Below you find a break down of what each part of its name means.
33+
As you can see there is one file in the `<plugin root>/src/Migration` directory. Below you'll find a breakdown of what each part of its name means.
3834

3935
| File Name Snippet | Meaning |
4036
|:-------------------|:------------------------------------------------|
@@ -106,11 +102,11 @@ class Migration1611740369ExampleDescription extends MigrationStep
106102

107103
As you can see, your migration contains three methods:
108104

109-
* getCreationTimestamp\(\)
110-
* update\(\)
111-
* updateDestructive\(\)
105+
* `getCreationTimestamp()`
106+
* `update()`
107+
* `updateDestructive()`
112108

113-
There is no need to change `getCreationTimestamp()`, it returns the timestamp that's also part of the file name. In the `update()` method you implement non-destructive changes which should always be **reversible**. The `updateDestructive()` method is the follow up step, that is run after `update()` and used for **destructive none reversible changes**, like dropping columns or tables. Destructive migrations are only executed explicitly.
109+
There is no need to change `getCreationTimestamp()`, it returns the timestamp that's also part of the file name. In the `update()` method you implement non-destructive changes which should always be **reversible**. The `updateDestructive()` method is the follow up step, that is run after `update()` and used for **destructive non-reversible changes**, like dropping columns or tables. Destructive migrations are only executed explicitly.
114110

115111
::: info
116112
You do not add instructions to revert your migrations within the migration class itself. `updateDestructive` is not meant to revert instructions in `update`. Reverting changes in the database is done explicitly in plugin lifecycle method `uninstall`, as explained in the [Plugin Lifecycle guide](../plugin-fundamentals/plugin-lifecycle.md#uninstall).
@@ -169,7 +165,7 @@ This command will generate a new migration file including the `CREATE TABLE` or
169165
| Option | Meaning |
170166
|:-----------|:---------------------------------------------------------------------------------------------------------------------|
171167
| --bundle | The name of the plugin, when not provided the command will generate a migration in the core |
172-
| --entities | Comma-seperated list of the entities it should create migrations for, it will generate one migration file per entity |
168+
| --entities | Comma-separated list of the entities it should create migrations for, it will generate one migration file per entity |
173169

174170
_Note: Your plugin has to be activated, otherwise your custom entity definition cannot be found._
175171

@@ -194,7 +190,7 @@ $ ./bin/console database:migrate SwagBasicExample --all
194190

195191
## Advanced migration control
196192

197-
Once you have become familiar with the migration process and the development flow, you may want to have finer control over the migrations performed during the installation and update. In this case the `MigrationCollection` which is only filled with your specific migrations, can be accessed via the `InstallContext` and all its subclasses \(UpdateContext, ActivateContext, ...\). A plugin must reject the automatic execution of migrations in order to have control over the migrations that are executed.
193+
Once you have become familiar with the migration process and the development flow, you may want to have finer control over the migrations performed during the installation and update. In this case the `MigrationCollection` which is only filled with your specific migrations, can be accessed via the `InstallContext` and all its subclasses (UpdateContext, ActivateContext, ...). A plugin must reject the automatic execution of migrations in order to have control over the migrations that are executed.
198194

199195
Therefore, a typical update method might look more like this:
200196

@@ -213,4 +209,4 @@ Therefore, a typical update method might look more like this:
213209
}
214210
```
215211

216-
If you don't use the Shopware migration system, an empty collection \(NullObject\) will be in the context.
212+
If you don't use the Shopware migration system, an empty collection (`NullObject`) will be in the context.

guides/plugins/plugins/database/index.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ This section covers:
1414
* How to generate migrations from entity definitions
1515
* How to work with custom fields (e.g., media custom fields)
1616

17-
## Guides
17+
Use migrations for schema changes and structural updates. Use custom fields to extend existing entities without modifying the core schema.
1818

1919
* <PageRef page="./database-migrations" />
2020
* <PageRef page="./custom-fields-of-type-media" />
21-
22-
Use migrations for schema changes and structural updates. Use custom fields to extend existing entities without modifying the core schema.

guides/plugins/plugins/in-app-purchases.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ nav:
88
# In-App Purchases
99

1010
::: info
11-
In-App Purchase is available since Shopware version 6.6.9.0
11+
In-App Purchases are available since Shopware version 6.6.9.0
1212
:::
1313

1414
In-App Purchases are a way to lock certain features behind a paywall within the same extension.
@@ -20,9 +20,9 @@ and then offer a paid version with more features.
2020

2121
## Allow users to buy an In-App Purchase
2222

23-
In order to enable others to purchase your In-App Purchase, you must request a checkout for it via the `inAppPurchaseCheckout` store in the administration.
23+
In order to enable others to purchase your In-App Purchase, you must request a checkout for it via the `inAppPurchaseCheckout` store in the Administration.
2424
The checkout process itself is provided by Shopware.
25-
As this is purely functional, it is your responsibility to provide a button and hide it if the IAP cannot be purchased more than once.
25+
It is your responsibility to provide a button and hide it if the IAP cannot be purchased more than once.
2626

2727
```ts
2828
{
@@ -69,13 +69,15 @@ class Example
6969
If you want to check an in-app purchase in the administration:
7070

7171
```js
72-
if (Shopware.InAppPurchase.isActive('MyExtensionName', 'my-iap-identifier')) {};
72+
if (Shopware.InAppPurchase.isActive('MyExtensionName', 'my-iap-identifier')) {
73+
// ...
74+
}
7375
```
7476

75-
## Event
77+
## Listen to In-App Purchase events
7678

7779
Apps are also able to manipulate the available In-App Purchases as described in
78-
<PageRef page="../apps/gateways/in-app-purchase/in-app-purchase-gateway" title="In App purchase gateway" />
80+
<PageRef page="../apps/gateways/in-app-purchase/in-app-purchase-gateway" title="In App purchase gateway" />.
7981

8082
Plugins can listen to the `Shopware\Core\Framework\App\InAppPurchases\Event\InAppPurchasesGatewayEvent`.
8183
This event is dispatched after the In-App Purchases Gateway has received the app server response from a gateway

guides/plugins/plugins/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Plugins run directly inside the Shopware environment and provide full access to:
2020

2121
Technically, plugins are extensions of [Symfony bundles](./bundle.md). They follow a defined directory structure and, when used as managed extensions, provide a lifecycle (install, update, deactivate, uninstall).
2222

23-
Plugins can ship their own assets, controllers, services, and tests, enabling deep platform and full extensibility across core and custom functionality.
23+
Plugins can ship their own assets, controllers, services, and tests, enabling deep extensibility across core and custom functionality.
2424

2525
## When to create and use a plugin
2626

@@ -99,7 +99,7 @@ Managed plugins are commonly used for marketplace-distributed extensions. They a
9999

100100
### Bundles
101101

102-
Symfony-based [bundles](../plugins/bundle.md) are installed via Composer. They do not have a Shopware plugin lifecycle and are not managed via the Administration.
102+
Symfony-based [bundles](./bundle.md) are installed via Composer. They do not have a Shopware plugin lifecycle and are not managed via the Administration.
103103

104104
Bundles are useful when you want:
105105

@@ -119,7 +119,7 @@ For custom projects, it is often preferable to:
119119
* Share one CI pipeline and one set of static analysis rules
120120
* Organize functionality through clean internal directory structure
121121

122-
It does not matter whether static plugins or Symfony bundles internally are used, as much as having:
122+
It does not matter whether static plugins or Symfony bundles are used internally, as much as having:
123123

124124
* Clear domain boundaries
125125
* Consistent structure

guides/plugins/plugins/install-activate-plugin.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ From your Shopware project root directory, refresh the list of plugins:
1515
bin/console plugin:refresh
1616
```
1717

18-
A warning about the `version` field of the `composer.json` file might appear; this can be ignored. You should see a list like this:
18+
You should see a list like this:
1919

2020
```bash
2121
Shopware Plugin Service
@@ -28,15 +28,19 @@ Shopware Plugin Service
2828
------------------------------ -------------------------------------------- ----------- ----------------- ---------------------------- ----------- -------- -------------
2929
```
3030

31-
This output is a **good sign**, because this means Shopware recognized your plugin successfully.
31+
This output confirms the plugin was loaded correctly.
32+
33+
::: info
34+
If a warning about the `version` field in `composer.json` appears, it is expected and does not affect the result.
35+
:::
3236

3337
Now install and activate:
3438

3539
```bash
3640
bin/console plugin:install --activate SwagBasicExample
3741
```
3842

39-
This should print the following output:
43+
This prints the following output:
4044

4145
```bash
4246
Shopware Plugin Lifecycle Service
@@ -48,7 +52,7 @@ Shopware Plugin Lifecycle Service
4852
Plugin "SwagBasicExample" has been installed and activated successfully.
4953
```
5054

51-
If successful, your plugin is now active and ready to use!
55+
Your plugin is now installed and active.
5256

5357
## Next steps
5458

0 commit comments

Comments
 (0)