' .
'' .
esc_html__( 'Video (ARVE)', 'advanced-responsive-video-embedder' ) .
'',
[
'type' => 'button',
'class' => 'arve-btn button add_media',
'title' => __(
'Advanced Responsive Video Embedder Shortcode Creator',
'advanced-responsive-video-embedder'
),
'data-wp-interactive' => DIALOG_NAMESPACE,
'data-wp-on--click' => 'actions.openShortcodeDialog',
'data-editor' => $editor_id,
],
);
echo wp_interactivity_process_directives( $btn_html ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
add_action( 'admin_footer', __NAMESPACE__ . '\create_shortcode_dialog' );
}
function dialog_interactivity(): void {
static $ran_already = false;
if ( $ran_already ) {
return;
}
$ran_already = true;
$options = array();
foreach ( settings( 'shortcode' )->get_all() as $k => $setting ) {
if ( 'boolean' === $setting->type && ! $setting->option ) {
$options[ $k ] = $setting->default;
} else {
$options[ $k ] = '';
}
}
wp_interactivity_config(
DIALOG_NAMESPACE,
[
'nonce' => wp_create_nonce( 'wp_rest' ),
'siteUrl' => get_site_url(),
'homeUrl' => get_home_url(),
'defaultOptions' => array(),
]
);
wp_interactivity_state(
DIALOG_NAMESPACE,
[
'options' => $options,
'shortcode' => '[arve url="" /]',
'message' => '',
'help' => false,
]
);
}
function create_shortcode_dialog(): void {
ob_start();
?>