Skip to content

Commit

Permalink
Merge pull request #1 from etienne-monsieurbiz/feat/update-comments
Browse files Browse the repository at this point in the history
Update comments + readme
  • Loading branch information
jacquesbh authored Mar 22, 2024
2 parents 760c0c4 + b64c4be commit e86b2f4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ jobs:

- run: make test.yaml

- run: make test.twig

- run: make test.schema

- run: make test.container
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sylius Plus Adapter Plugin

This plugin offer tools to adapt your plugins to Sylius Plus ACL system.
This plugin offer tools to adapt your plugins to Sylius Plus RBAC system.

There is no point in installing this plugin directly on Sylius Plus app at this time.

Expand Down Expand Up @@ -37,9 +37,9 @@ sylius_resource:
### Add permissions on routes
It's a Sylius native feature, you don't have to install this plugin !
It's a Sylius native feature, you don't have to install this plugin!
You just have to add `permission: true` on your route definition.
If you do this, your route will decame available on the permission tree.
If you do this, your route will become available on the permission tree.

#### Example

Expand Down Expand Up @@ -127,7 +127,7 @@ class FooSyliusBarPluginExtension extends Extension implements PrependExtensionI
$container,
'foo_bar_my_resource', // This is the grid name
'%foo_bar.model.my_resource.class%', // This is the resource class as in your original grid
"expr:service('foo_bar.repository.my_resource').createListQueryBuilder('%locale%')" // This is the original query builder but as an expression call
"expr:service('foo_bar.repository.my_resource').createListQueryBuilder('%locale%')" // This is the original query builder but called as an expression
);
}
}
Expand All @@ -139,7 +139,7 @@ To filter the channel choice type with channel restriction, you need to include

#### Example

***Your current resource forme type***
***Your current resource form type***
```php
namespace Foo\SyliusBarPlugin\Form\Type;
Expand Down Expand Up @@ -190,10 +190,10 @@ class FooSyliusBarPluginExtension extends Extension implements PrependExtensionI
## Development

Because this plugin is a kind of sidekick for your plugins, it's not intended to be used in a standalone project.
Even more because it requires Sylius Plus to be useful. Our traditionnal test application then seems useless.
Even more because it requires Sylius Plus to be useful. Our traditional test application then seems useless.

But to be fair, we still added a test app with our CMS plugin installed and configured to use the `SyliusPlusCompatibilityTrait` trait.
It would be useful to be sure that everything is working as expected in a normal Sylius event if this plugin is installed and used.
It would be useful to be sure that everything is working as expected in a normal Sylius even if this plugin is installed and used.

## License

Expand Down
6 changes: 3 additions & 3 deletions src/DependencyInjection/SyliusPlusCompatibilityTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function enabledFilteredChannelChoiceType(ContainerBuilder $container, ar
return;
}

// For each type with a channel choice list to filter we crate a "virtual" type extension based on the FilteredChannelChoiceTypeExtension
// For each type with a channel choice list to filter we create a "virtual" type extension based on the FilteredChannelChoiceTypeExtension
// class to override channel(s) fields of original types.
foreach ($extendables as $code => $type) {
$container->setDefinition(
Expand Down Expand Up @@ -71,14 +71,14 @@ public function replaceInGridOriginalQueryBuilderWithChannelRestrictedQueryBuild
return;
}

// Add alias because class name in `expr:service` seems not working
// Add alias because class name in `expr:service` seems to not work
$container->setAlias(
'monsieurbiz_cms_page.sylius_plus_adapter.channel_restricted_query_builder',
ChannelRestrictionQueryBuilderInterface::class
)->setPublic(true);

// Override grid repository method to use a kind of decorator around the original query builder to add
// channel restritions if needed.
// channel restrictions if needed.
$container->loadFromExtension('sylius_grid', [
'grids' => [$grid => ['driver' => ['options' => [
'class' => $class,
Expand Down
4 changes: 2 additions & 2 deletions src/Form/Extension/FilteredChannelChoiceTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
return;
}

// In case of multiple channels and channel restriction, we need to save the channels that are not available
// To avoid loosing them when saving the form
// In case of multiple channels and channel restriction, we need to save the channels that are not available
// To avoid losing them when saving the form
$form = $event->getForm();
/** @var array $availableChannels */
$availableChannels = $form->get(self::CHANNELS)->getConfig()->getOptions()['choices'] ?? [];
Expand Down

0 comments on commit e86b2f4

Please sign in to comment.