pingpong-labs / shortcode

Laravel 5 Shortcode
https://pingpong-labs.github.io/docs/shortcode.html
BSD 3-Clause "New" or "Revised" License
39 stars 21 forks source link

Default attributes #2

Open braseidon opened 10 years ago

braseidon commented 10 years ago

Hey there, awesome package! I've already gotten a ton of use for this.

This isn't really an issue, I was just wondering how you would go about adding default attributes for each shortcode. Currently I am creating a new file for each shortcode class, and registering them when the application loads the content. Each shortcode has its own default attributes set as protected variables. If the array_get turns up null, then we grab the default attribute.

Cheers!

braseidon commented 10 years ago

After looking into this... I found that array_get actually has a default attribute!

array_get($array, $key, $default = null)