How to load Button shortcode dynamic / inline styles from Pricing Tables shortcode?
Hello!
Unyson allows to add any shortcode into Pricing tables in following way (class-fw-option-type-table.php):
'button-row' => array(
'button' => ( $button = fw()->extensions->get( 'shortcodes' )->get_shortcode( 'button' ) )
? array(
'type' => 'popup',
'popup-title' => __( 'Button', 'mytheme' ),
'button' => __( 'Add', 'mytheme' ),
'popup-options' => $button->get_options()
)
: array()
),
it is so good, and it allows to use all button shortcode options inside Pricing Tables, but it doesn't load dynamic / inline styles for a button automatically.
Is there a way to load inline styles for a button from Pricing table?
When i add "_action_shortcode_button_enqueue_dynamic_css();" function in "static.php" file (in Table extension), i get "function doesn't exist" error, also i tried do_action('fw_ext_shortcodes_enqueue_static:button'); but it falls with erros:
<b>Warning</b>: Illegal string offset 'atts_string' in <b>\framework-customizations\extensions\shortcodes\shortcodes\button\static.php</b> on line <b>12</b><br />
<br />
<b>Notice</b>: Uninitialized string offset: 0 in <b>\framework-customizations\extensions\shortcodes\shortcodes\button\static.php</b> on line <b>12</b><br />
<br />
<b>Warning</b>: Illegal string offset 'post' in <b>\framework-customizations\extensions\shortcodes\shortcodes\button\static.php</b> on line <b>13</b><br />
<br />
<b>Notice</b>: Uninitialized string offset: 0 in <b>\framework-customizations\extensions\shortcodes\shortcodes\button\static.php</b> on line <b>13</b><br />
<br />
<b>Notice</b>: Trying to get property of non-object in <b>\framework-customizations\extensions\shortcodes\shortcodes\button\static.php</b> on line <b>13</b><br />
<br />
<b>Catchable fatal error</b>: Argument 1 passed to fw_ext_shortcodes_decode_attr() must be of the type array, string given, called in \framework-customizations\extensions\shortcodes\shortcodes\button\static.php on line 13 and defined in <b>\wp-content\plugins\unyson\framework\extensions\shortcodes\helpers.php</b> on line <b>10</b><br />
sorry if this is a noob question, but i can't find any point in documentation regarding this.
So, we have static.php file in Tables shortcode, and is there any way to call "fw_ext_shortcodes_enqueue_static:button" action from Pricing Tables?
Thank you so much!
I think this code is better
'button-row' => ( $button = fw_ext( 'shortcodes' )->get_shortcode( 'button' ) )
? array(
'button' => array(
'type' => 'popup',
'popup-title' => __( 'Button', 'mytheme' ),
'button' => __( 'Add', 'wplab-albedo' ),
'popup-options' => $button->get_options()
)
)
: array(),
So, we have static.php file in Tables shortcode, and is there any way to call "fw_ext_shortcodes_enqueue_static:button" action from Pricing Tables?
Try
if ($button = fw_ext( 'shortcodes' )->get_shortcode( 'button' )) { /** @var FW_Shortcode $button */
$button->_enqueue_static();
}
@moldcraft sorry, but it is still not working. What am i doing wrong? Please see my static.php from table shortcode
<?php if (!defined('FW')) die('Forbidden');
if (!function_exists('_action_mytheme_shortcode_table_enqueue_dynamic_css')):
/**
* @internal
* @param array $data
*/
function _action_mytheme_shortcode_table_enqueue_dynamic_css( $data ) {
wp_dequeue_style( 'fw-shortcode-table' );
wp_enqueue_style(
'mytheme-tables',
mytheme_utils::locate_uri( '/css/front/css/shortcodes/table.css' )
);
wp_enqueue_style( 'mytheme-table_variable' );
if ($button = fw_ext( 'shortcodes' )->get_shortcode( 'button' )) { /** @var FW_Shortcode $button */
$button->_enqueue_static();
}
}
add_action(
'fw_ext_shortcodes_enqueue_static:table',
'_action_mytheme_shortcode_table_enqueue_dynamic_css'
);
endif;
Can you give admin/ftp access and the steps to reproduce the problem? moldcraft[at]email.com
I don't know how to test. Using your code I get errors that I don't have the wplab_albedo_utils class and undefined option type. I commented those lines but I get this

Can you give TeamViewer access?
Hi again, @moldcraft!
Please, download this file (stripped version), it works with default "scratch-child" theme, unzip it's content into \wp-content\themes\scratch-child\framework-customizations\extensions\shortcodes\shortcodes\
Please see screenshots attached:
-
Border radius for button in admin part

-
it works fine at front-end

-
border radius in Table Button, admin part

-
doesn't work at front-ent

thank you for your patience and for your attention
Hi, @moldcraft, i see this ticket is closed, but after upgrading Unyson to 2.6.0, this still not working. Could you tell me what should i do to run this?
These changes will be included in Shortcodes extension v1.3.20