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

Attribute Casting #62

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

stephenoldham
Copy link

Initial stab at adding attribute casting, making use of the HasAttributes trait from Laravel. For better boolean casting attributes are set to false when defined in $casts property but not present on the shortcode. For example:

class Example extends Shortcode
{
    protected $casts = [
        'disabled' => 'boolean',
    ];

Usage:

[example /] // disabled attribute resolves to false
[example disabled /] // disabled attribute resolves to true
[example disabled="true" /] // disabled attribute resolves to true

#2

@tehwave
Copy link
Owner

tehwave commented Sep 21, 2023

Hi Steve,

Thanks for the PR!

Sorry that I'm so late to see it. The notification must have ended up with a bunch of others.

Cool if I take your code and keep working on it? I'll ensure you're added as co-author, so that you're credited for this work.

@tehwave tehwave reopened this Sep 21, 2023
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.

None yet

2 participants