-
Notifications
You must be signed in to change notification settings - Fork 1
Introduce #[AsBlock]
attribute
#16
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #16 +/- ##
============================================
- Coverage 92.20% 91.69% -0.52%
- Complexity 52 70 +18
============================================
Files 7 12 +5
Lines 231 313 +82
============================================
+ Hits 213 287 +74
- Misses 18 26 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces the new #[AsBlock] attribute to register Storyblok blocks in Symfony applications and adds documentation on its usage, including default template path customization and a new Twig filter for rendering blocks.
- Introduces the #[AsBlock] attribute to define Storyblok blocks.
- Documents the default template path configuration and customizable settings.
- Adds a new Twig filter, render_block, for dynamic block rendering.
Co-authored-by: Copilot <[email protected]>
I like it, except technicalName should be name |
In storyblok its called |
https://github.com/php-llm/llm-chain/blob/main/src/Chain/ToolBox/Attribute/AsTool.php why should it be reserved? |
04c3599
to
dbe57aa
Compare
Co-authored-by: Edoardo Dusi <[email protected]>
All good i changed it. i think i called the wrong variable that time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces the #[AsBlock] attribute for defining Storyblok blocks in Symfony applications and updates the documentation accordingly.
- Adds a new section to README.md for block registration and usage examples.
- Provides guidance on configuring default template paths and rendering blocks in Twig.
Comments suppressed due to low confidence (1)
README.md:201
- The parameter 'name' is used instead of 'technicalName' as described in the PR title and metadata. Update the parameter to 'technicalName' for consistency.
#[AsBlock(name: 'sample', template: 'custom_blocks/sample.html.twig')]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work 👏
This PR introduces a powerful new way to define Storyblok blocks in Symfony applications using the
#[AsBlock]
attribute. This feature enables developers to register blocks generically, ensuring consistency and simplifying block management.Key Features
1.
#[AsBlock]
Attributename
andtemplate
.name
is omitted, the system will automatically convert the class name to camelCase (e.g.,SampleBlock
→sample_block
).template
parameter specifies the Twig template used for rendering. If omitted, a default template path is derived.2. Default Template Path Configuration
3. New Twig Extension:
BlockExtension
render_block
filter for rendering Storyblok blocks effortlessly.Example: Defining a Block with
#[AsBlock]
This class:
sample_block
.custom_blocks/sample.html.twig
.This PR brings significant flexibility and ease to managing Storyblok blocks within Symfony, making integration more intuitive and robust.