jtsternberg/Shortcode_Button

Add shortcode atts to _before_send filters

JiveDig opened this issue · 2 comments

Thanks for this class, it's awesome.

I have a complex shortcode that is way overkill to try to display correctly in the admin. I'm using these filters https://github.com/jtsternberg/Shortcode_Button/blob/master/lib/class-shortcode-button.php#L463-L464 to just render a clean block with some text in the admin as a pseudo-placeholder, mostly so I can utilize the built-in Edit/Remove functionality.

If I had access to the original or sanitized shortcode atts, I could better customize the admin display/HTML according to a few key parameters in my shortcode.

Hope that makes sense. Thanks.

I can't think of a way to get the atts passed to this class, so totally okay if you wanna close this issue. Just figured I'd mention it cause it would be cool if you can think of a way.

I did a bit of refactoring. Now the 2nd param to those filters is an instance of Shortcode_Button_MCE and has 4 accessible properties:

$mce_handler->full_shortcode - The full shortcode being parsed in the tinymce instance.
$mce_handler->post_id - The admin post being edited.
$mce_handler->atts - The parsed shortcode attributes.
$mce_handler->btn - The original Shortcode_Button object.

Will release an update once i get #19 in.