# Shopware Plugin Completion

**Completion** features provide context-aware suggestions for Shopware storefronts, administration modules, DAL, system config, app scripts, Twig, Smarty, and plugin APIs.

---

## Shopware storefront Twig completion

**Feature ID:** `PlatformTwigCompletion`  
**Feature Page:** [Shopware storefront Twig completion](https://espend.de/phpstorm/plugin/shopware#platform-twig-completion)  

Completes Shopware storefront template names and helper arguments for Shopware Twig tags and helpers such as `sw_extends`, `sw_include`, `sw_icon`, and `sw_thumbnails`.

### Code Examples

```twig
# Storefront Twig:
{% sw_extends '@Storefront/storefront/page/content/index.html.twig' %}
{% sw_include '@Storefront/storefront/component/product/card/box.html.twig' %}
{% sw_icon 'shopping-bag' style { 'pack': 'solid' } %}
{% sw_thumbnails 'product-image-thumbnails' with {
    media: product.cover.media
} %}
```

---

## sw_icon name and pack completion

**Feature ID:** `PlatformSwIconCompletion`  
**Feature Page:** [sw_icon name and pack completion](https://espend.de/phpstorm/plugin/shopware#platform-sw-icon-completion)  

Completes storefront icon names and pack values from indexed SVG icon packs.

### Code Examples

```twig
# Icon call:
{% sw_icon 'shopping-bag' style { 'pack': 'solid' } %}
```

---

## sw_thumbnails name completion

**Feature ID:** `PlatformSwThumbnailCompletion`  
**Feature Page:** [sw_thumbnails name completion](https://espend.de/phpstorm/plugin/shopware#platform-sw-thumbnail-completion)  

Completes indexed `sw_thumbnails` names so repeated thumbnail blocks stay connected to existing storefront usages.

### Code Examples

```twig
# Thumbnail block:
{% sw_thumbnails 'product-image-thumbnails' with {
    media: product.cover.media
} %}
```

---

## activeRoute route name completion

**Feature ID:** `ShopwareActiveRouteCompletionContributor`  
**Feature Page:** [activeRoute route name completion](https://espend.de/phpstorm/plugin/shopware#shopware-active-route-completion-contributor)  

Completes route names in Twig `activeRoute` comparisons so navigation states stay connected to real routes.

### Code Examples

```twig
# Exact route comparison:
{% if activeRoute == 'frontend.account.home.page' %}
    active
{% endif %}
```

```twig
# Prefix check for route groups:
{% if activeRoute starts with 'frontend.account.' %}
    active
{% endif %}
```

```twig
# Multiple route names:
{% if activeRoute in [
    'frontend.account.profile.page',
    'frontend.account.address.page',
    'frontend.account.order.page'
] %}
    active
{% endif %}
```

```twig
# Inline class expression:
<a class="nav-link {{ activeRoute == 'frontend.checkout.cart.page' ? 'is-active' }}">
    {{ 'checkout.cartTitle'|trans }}
</a>
```

---

## Navigate from activeRoute to route definitions

**Feature ID:** `ShopwareActiveRouteGotoHandler`  
**Feature Page:** [Navigate from activeRoute to route definitions](https://espend.de/phpstorm/plugin/shopware#shopware-active-route-goto-handler)  

Navigates from literal route names in Twig `activeRoute` checks to the matching route definition.

### Code Examples

```twig
# Exact route comparison:
{% if activeRoute == 'frontend.account.home.page' %}
    active
{% endif %}
```

```twig
# Prefix check for route groups:
{% if activeRoute starts with 'frontend.account.' %}
    active
{% endif %}
```

```twig
# Multiple route names:
{% if activeRoute in [
    'frontend.account.profile.page',
    'frontend.account.address.page',
    'frontend.account.order.page'
] %}
    active
{% endif %}
```

```twig
# Inline class expression:
<a class="nav-link {{ activeRoute == 'frontend.checkout.cart.page' ? 'is-active' }}">
    {{ 'checkout.cartTitle'|trans }}
</a>
```

---

## Feature flag completion in PHP, Twig, and SCSS

**Feature ID:** `PlatformFeatureFlagCompletion`  
**Feature Page:** [Feature flag completion in PHP, Twig, and SCSS](https://espend.de/phpstorm/plugin/shopware#platform-feature-flag-completion)  

Completes Shopware feature flag names across PHP, Twig, and SCSS and keeps them linked to the indexed flag definitions.

### Code Examples

```php
# PHP:
if (Feature::isActive('v6.7.0.0')) {
    // new behavior
}
```

```twig
# Twig:
{% if feature('v6.7.0.0') %}
    New storefront markup
{% endif %}
```

```scss
# SCSS:
@if feature('v6.7.0.0') {
    .product-box { gap: 1rem; }
}
```

---

## Navigate from feature flags to definitions

**Feature ID:** `PlatformFeatureFlagGotoHandler`  
**Feature Page:** [Navigate from feature flags to definitions](https://espend.de/phpstorm/plugin/shopware#platform-feature-flag-goto-handler)  

Navigates from Shopware feature flag usages in PHP, Twig, and SCSS to the indexed feature definition.

### Code Examples

```php
# PHP:
if (Feature::isActive('v6.7.0.0')) {
    // new behavior
}
```

```twig
# Twig:
{% if feature('v6.7.0.0') %}
    New storefront markup
{% endif %}
```

```scss
# SCSS:
@if feature('v6.7.0.0') {
    .product-box { gap: 1rem; }
}
```

---

## System config key completion

**Feature ID:** `PlatformSystemConfigPhpCompletionContributor`  
**Feature Page:** [System config key completion](https://espend.de/phpstorm/plugin/shopware#platform-system-config-php-completion-contributor)  

Completes plugin and app system config keys in PHP read and write calls based on indexed config XML definitions.

### Code Examples

```php
# System config calls:
$label = $this->systemConfigService->get('SwagExample.config.buttonLabel');
$this->systemConfigService->set('SwagExample.config.buttonLabel', 'Buy now');
```

---

## DAL field and association completion

**Feature ID:** `PlatformDalCompletion`  
**Feature Page:** [DAL field and association completion](https://espend.de/phpstorm/plugin/shopware#platform-dal-completion)  

Completes DAL field names, associations, and nested paths in PHP Criteria code and Administration repository code.

### Code Examples

```php
# PHP Criteria:
$criteria = (new Criteria())
    ->addAssociation('manufacturer')
    ->addFilter(new EqualsFilter('manufacturer.name', $name));
```

```javascript
# Administration repository:
const criteria = new Criteria();
criteria.addAssociation('manufacturer');
criteria.addFilter(Criteria.equals('manufacturer.name', value));
```

---

## Theme config SCSS variable completion

**Feature ID:** `PlatformThemeConfigScssCompletionContributor`  
**Feature Page:** [Theme config SCSS variable completion](https://espend.de/phpstorm/plugin/shopware#platform-theme-config-scss-completion-contributor)  

Completes SCSS variables generated from Shopware theme configuration fields.

### Code Examples

```scss
# Theme SCSS:
.btn-primary {
    color: $sw-color-brand-primary;
}
```

---

## Navigate from theme SCSS variables to theme config

**Feature ID:** `PlatformThemeConfigScssGotoHandler`  
**Feature Page:** [Navigate from theme SCSS variables to theme config](https://espend.de/phpstorm/plugin/shopware#platform-theme-config-scss-goto-handler)  

Navigates from generated theme SCSS variable usages to the field definition in theme configuration.

### Code Examples

```scss
# Theme SCSS variable:
.cms-section {
    background-color: $sw-background-color;
}
```

---

## Administration snippet completion in template attributes

**Feature ID:** `PlatformHtmlTwigCompletion`  
**Feature Page:** [Administration snippet completion in template attributes](https://espend.de/phpstorm/plugin/shopware#platform-html-twig-completion)  

Completes snippet translation calls inside Administration Twig and HTML attributes.

### Code Examples

```html
# Administration template attribute:
<sw-text-field :label="$tc('swag-example.form.label')" />
```

---

## Administration mixin name completion

**Feature ID:** `PlatformAdminMixinJavascriptCompletionContributor`  
**Feature Page:** [Administration mixin name completion](https://espend.de/phpstorm/plugin/shopware#platform-admin-mixin-javascript-completion-contributor)  

Completes registered Administration mixin names in JavaScript and TypeScript mixin lookups.

### Code Examples

```javascript
# Mixin lookup:
const notification = Shopware.Mixin.getByName('notification');
```

---

## Administration module route completion

**Feature ID:** `PlatformAdminModuleRouteCompletionContributor`  
**Feature Page:** [Administration module route completion](https://espend.de/phpstorm/plugin/shopware#platform-admin-module-route-completion-contributor)  

Completes Administration module route names in route-link and router usages.

### Code Examples

```javascript
# Module route usage:
this.$router.push({ name: 'sw.product.detail', params: { id } });
```

---

## Administration component slot completion

**Feature ID:** `PlatformAdminComponentSlotCompletionContributor`  
**Feature Page:** [Administration component slot completion](https://espend.de/phpstorm/plugin/shopware#platform-admin-component-slot-completion-contributor)  

Completes available Administration extension slot names for the component used in Twig or HTML templates, using the same slot model as navigation and Vue validation.

### Code Examples

```html
# Slot usage:
<sw-page>
    <template #smart-bar-actions>
        <sw-button variant="primary">Save</sw-button>
    </template>
</sw-page>
```

---

## App script facade argument completion

**Feature ID:** `ShopwareAppTwigCompletion`  
**Feature Page:** [App script facade argument completion](https://espend.de/phpstorm/plugin/shopware#shopware-app-twig-completion)  

Completes entity names and config keys in type-resolved app-script facade calls, including repository, store, writer, and system config services.

### Code Examples

```twig
# App script facade calls:
{% set products = services.repository.search('product', criteria) %}
{% set ids = services.store.ids('product', criteria) %}
{% set result = services.writer.upsert('custom_entity_blog', payload) %}
{% set threshold = services.config.app('freeShippingThreshold') %}
{% set value = services.config.get('AgencyWorkflowApp.config.freeShippingThreshold') %}
```

---

## Snippet translation key completion

**Feature ID:** `TranslationReferenceCompletion`  
**Feature Page:** [Snippet translation key completion](https://espend.de/phpstorm/plugin/shopware#translation-reference-completion)  

Completes Shopware snippet keys in PHP and Administration JavaScript translation calls.

### Code Examples

```php
# PHP:
$this->trans('checkout.cart.title');
```

```javascript
# Administration JavaScript:
this.$tc('sw-product.detail.title');
```

---

