webwizo / laravel-shortcodes

Wordpress like shortcodes for Laravel 4.2, 5.x, 6.x, 7.x, 8.x, 9.x and 10.x
MIT License
211 stars 49 forks source link

How can we add multiple classes in shortcode ? #27

Open vipertecpro opened 6 years ago

vipertecpro commented 6 years ago

I've registered this
Shortcode::register('colmd3', 'App\Shortcodes\ColumnShortcode@colmd3'); into my ShortcodesServiceProvider while applying it's working fine

[colmd3 class="col-sm-4"]
[/colmd3]

but extra class is not applying

[colmd3 class="col-sm-4 text-center"]
[/colmd3]

This is my ColumnShortcode provider

class ColumnShortcode 
{
  public function colmd3($shortcode, $content)
  {
    return sprintf('<div class = "col-md-3 %s">%s</div>', $shortcode->class, $content);
  }
}

Please help, Thank you

Krishan19 commented 5 years ago

update src/Compilers/ShortcodeCompiler.php class "parseAttributes" method

$text = htmlspecialchars_decode($text, ENT_QUOTES);