Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a semantic bundle configuration #21

Merged
merged 12 commits into from
May 31, 2022
Merged

Provide a semantic bundle configuration #21

merged 12 commits into from
May 31, 2022

Conversation

mpdude
Copy link
Member

@mpdude mpdude commented May 27, 2022

Instead of having to set up service configuration like this:

<service id="webfactory.shortcode.your-shortcode-name" parent="Webfactory\ShortcodeBundle\Handler\EmbeddedShortcodeHandler.inline" class="Webfactory\ShortcodeBundle\Handler\EmbeddedShortcodeHandler">
    <argument index="1">reference-to-your-replacement-controller</argument>
    <tag name="webfactory.shortcode" shortcode="your-shortcode-name"/>
</service>

... and using the Webfactory\ShortcodeBundle\Handler\EmbeddedShortcodeHandler.inline or Webfactory\ShortcodeBundle\Handler\EmbeddedShortcodeHandler.esi parent services, with this PR you can instead write:

# config.yml
webfactory_shortcode:
  shortcodes:
    my-shortcode: 'My\Handling\Controller::method'
    another-shortcode:
      controller: 'My\Handling\Controller::method'
      method: esi

The first is a shorthand notation to register the my-shortcode shortcode which will be rendered with the inline strategy. The second is a bit more elaborate, but allows to specify esi as the rendering strategy.

@mpdude mpdude changed the title Allow setting up shortcodes via config Provide a semantic bundle configuration May 27, 2022
@mpdude mpdude force-pushed the shortcode-as-config branch from 3b6102c to 9234a86 Compare May 27, 2022 16:04
mpdude and others added 5 commits May 27, 2022 16:07
Removed "optional", as the `guide.xml` is always included. You can still chose not include the guide in your routing, but that's a little bit too short for me to call it "optional".
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
tests/Fixtures/TestKernel.php Outdated Show resolved Hide resolved
tests/Fixtures/config/test_shortcodes.xml Show resolved Hide resolved
tests/Functional/EndToEndTest.php Outdated Show resolved Hide resolved
tests/Functional/EndToEndTest.php Show resolved Hide resolved
tests/Functional/EndToEndTest.php Outdated Show resolved Hide resolved
@mpdude
Copy link
Member Author

mpdude commented May 30, 2022

Thank you for the exhaustive review!

@mpdude mpdude merged commit 6a0f46d into master May 31, 2022
@mpdude mpdude deleted the shortcode-as-config branch May 31, 2022 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants