2, 'editor_script' => 'bunstream-block', 'editor_style' => 'bunstream-editor', 'attributes' => array( 'id' => array('type' => 'string', 'default' => ''), 'title' => array('type' => 'string', 'default' => ''), 'maxWidth' => array('type' => 'string', 'default' => ''), ), 'render_callback' => array(__CLASS__, 'render_block'), )); } public static function render_block($attributes) { $id = isset($attributes['id']) ? $attributes['id'] : ''; if ($id === '') { return ''; } return BunStream_Embed::render($id, '', isset($attributes['maxWidth']) ? $attributes['maxWidth'] : ''); } public static function media_button($editor_id) { if (!current_user_can('edit_posts')) { return; } printf( '', esc_attr($editor_id), esc_html__('إضافة درس BunStream', 'bunstream') ); } public static function classic_assets($hook) { if (!in_array($hook, array('post.php', 'post-new.php'), true) || !current_user_can('edit_posts')) { return; } wp_enqueue_script('bunstream-classic', BUNSTREAM_URL . 'assets/classic.js', array('wp-api-fetch', 'wp-i18n'), BUNSTREAM_VERSION, true); wp_set_script_translations('bunstream-classic', 'bunstream'); wp_enqueue_style('bunstream-editor', BUNSTREAM_URL . 'assets/editor.css', array(), BUNSTREAM_VERSION); } }