Skip to content

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".
@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.

3 participants