Skip to content

Commit

Permalink
Merge pull request #35 from etienne-monsieurbiz/feature/fix-fixtures
Browse files Browse the repository at this point in the history
Fix attribute link fixtures + footer templates + Add readme part
  • Loading branch information
maximehuran authored Apr 8, 2024
2 parents 6392b2f + f08bd79 commit be873bf
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 6 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ If you want to customize your menu, like adding an image, do so by overriding th

The front view is exactly the same as the default one.

## Customize front view

A menu can look very differently depending on where it should be displayed so most of the time you will need to create your own macro for the menu items.
A good place to start is the template of the main menu here: ```src/Resources/views/Layout/Header/_menu.html.twig``` where we define a macro for the menu items, and we use them directly in the template.

To get the first items of a menu you can call our custom twig function ```menu_first_level('main')``` where `main` is the code of the menu we want to retrieve.

## Contributing

You can open an issue or a Pull Request if you want! 😘
Expand Down
8 changes: 4 additions & 4 deletions src/Fixture/MenuFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ public function configureResourceNode(ArrayNodeDefinition $resourceNode): void
->children()
->scalarNode('label')->cannotBeEmpty()->end()
->scalarNode('url')->defaultValue('')->end()
->booleanNode('targetBlank')->defaultFalse()->end()
->booleanNode('noreferrer')->defaultFalse()->end()
->booleanNode('noopener')->defaultFalse()->end()
->booleanNode('nofollow')->defaultFalse()->end()
->end()
->end()
->end()
->booleanNode('targetBlank')->defaultFalse()->end()
->booleanNode('noreferrer')->defaultFalse()->end()
->booleanNode('noopener')->defaultFalse()->end()
->booleanNode('nofollow')->defaultFalse()->end()
->variableNode('children')->cannotBeEmpty()->defaultValue([])->end()
->end()
->end()
Expand Down
4 changes: 4 additions & 0 deletions src/Resources/config/sylius/fixtures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ sylius_fixtures:
fr_FR:
label: 'Nous contacter'
url: 'https://%env(SYLIUS_FIXTURES_HOSTNAME)%/#'
targetBlank: true
noreferrer: true
noopener: true
nofollow: true
- translations:
en_US:
label: 'FAQs'
Expand Down
10 changes: 9 additions & 1 deletion src/Resources/views/Layout/Footer/Grid/_customer_care.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@
<h4 class="ui inverted header">{{ 'sylius.ui.customer_care'|trans }}</h4>
<div class="ui inverted link list">
{% for item in footer_customer_care %}
<a class="item">{{ item.label }}</a>
{% set noreferrer = item.noreferrer %}
{% set noopener = item.noopener %}
{% set nofollow = item.nofollow %}
{% set hasRel = noreferrer or noopener or nofollow %}
<a href="{{ item.url }}" class="item" {% if item.targetBlank %}target="_blank"{% endif %}
{% if hasRel %}
rel="{% if noreferrer %}noreferrer{% endif %}{% if noopener %} noopener{% endif %}{% if nofollow %} nofollow{% endif %}"
{% endif %}>
{{ item.label }}</a>
{% endfor %}
</div>
</div>
Expand Down
10 changes: 9 additions & 1 deletion src/Resources/views/Layout/Footer/Grid/_your_store.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@
<h4 class="ui inverted header">{{ 'sylius.ui.your_store'|trans }}</h4>
<div class="ui inverted link list">
{% for item in footer_your_store %}
<a class="item">{{ item.label }}</a>
{% set noreferrer = item.noreferrer %}
{% set noopener = item.noopener %}
{% set nofollow = item.nofollow %}
{% set hasRel = noreferrer or noopener or nofollow %}
<a href="{{ item.url }}" class="item" {% if item.targetBlank %}target="_blank"{% endif %}
{% if hasRel %}
rel="{% if noreferrer %}noreferrer{% endif %}{% if noopener %} noopener{% endif %}{% if nofollow %} nofollow{% endif %}"
{% endif %}>
{{ item.label }}</a>
{% endfor %}
</div>
</div>
Expand Down

0 comments on commit be873bf

Please sign in to comment.