* @since 5.0.0 */ namespace Beyondwords\Wordpress\Component\Settings\Fields\WidgetStyle; use Beyondwords\Wordpress\Component\Settings\Sync; /** * WidgetStyle * * @since 5.0.0 */ defined('ABSPATH') || exit; class WidgetStyle { /** * Option name. * * @since 5.0.0 */ public const OPTION_NAME = 'beyondwords_player_widget_style'; /** * Constructor * * @since 5.0.0 * @since 6.0.0 Make static. */ public static function init() { add_action('admin_init', [self::class, 'addSetting']); add_action('pre_update_option_' . self::OPTION_NAME, function ($value) { Sync::syncOptionToDashboard(self::OPTION_NAME); return $value; }); } /** * Add setting. * * @since 4.5.0 * @since 6.0.0 Make static. * * @return void */ public static function addSetting() { register_setting( 'beyondwords_player_settings', self::OPTION_NAME, [ 'default' => '', ] ); add_settings_field( 'beyondwords-widget-style', __('Widget style', 'speechkit'), [self::class, 'render'], 'beyondwords_player', 'widget' ); } /** * Render setting field. * * @since 5.0.0 * @since 6.0.0 Make static. * * @return void **/ public static function render() { $current = get_option(self::OPTION_NAME); $options = self::getOptions(); ?>
'standard', 'label' => __('Standard', 'speechkit'), ], [ 'value' => 'none', 'label' => __('None', 'speechkit'), ], [ 'value' => 'small', 'label' => __('Small', 'speechkit'), ], [ 'value' => 'large', 'label' => __('Large', 'speechkit'), ], [ 'value' => 'video', 'label' => __('Video', 'speechkit'), ], ]; } }