Documentation

WP_Backstage
in package

WP Backstage

Tags
since
2.0.0

Table of Contents

$kses_label  : array<string|int, mixed>
KSES Label
$kses_p  : array<string|int, mixed>
KSES P
$errors  : array<string|int, mixed>
Errors
$plugin_dependencies  : array<string|int, mixed>
Plugin Dependencies
__construct()  : void
Construct
ajax_render_media()  : void
Ajax Render Media
enqueue_admin_scripts()  : void
Enqueue Admin Scripts
has_errors()  : bool
Has Errors
init()  : void
Init
inline_address_script()  : void
Inline Address Script
inline_code_editor_script()  : void
Inline Code Editor Script
inline_code_editor_style()  : void
Inline Code Editor Style
inline_color_picker_script()  : void
Inline Colorpicker Script
inline_customizer_style()  : void
Inline customizer Style
inline_date_picker_script()  : void
Inline Date picker Script
inline_editor_script()  : void
Inline Editor Script
inline_editor_style()  : void
Inline Editor Style
inline_global_script()  : void
Inline Global Script
inline_global_style()  : void
Inline Global Style
inline_media_mixin_overrides_script()  : void
Inline Media Mixin Overrides Script
inline_media_uploader_script()  : void
Inline Media Uploader Script
inline_media_uploader_style()  : void
Inline Media Uploader Style
inline_nav_menu_item_customizer_script()  : void
Inline Nav Menu Item Customizer Script
inline_nav_menu_item_script()  : void
Inline Nav Menu Item Script
inline_options_script()  : void
Inline Options Script
inline_post_type_script()  : void
Inline Post Type Script
inline_rest_api_preview_code_editor_script()  : void
Inline REST API Preview Code Editor Script
inline_taxonomy_script()  : void
Inline Taxonomy Script
inline_thumbnail_column_style()  : void
Inline Thumbnail Column Style
inline_user_script()  : void
Inline User Script
inline_widget_script()  : void
Inline Widget Script
print_errors()  : void
Print Errors
render_media_item()  : void
Render Media Item
is_plugin_active()  : bool
Is Plugin Active
set_errors()  : void
Set Errors

Properties

$kses_label

KSES Label

public static array<string|int, mixed> $kses_label = array('span' => array('id' => array(), 'class' => array(), 'style' => array()), 'em' => array('id' => array(), 'class' => array(), 'style' => array()), 'strong' => array('id' => array(), 'class' => array(), 'style' => array()), 'code' => array('id' => array(), 'class' => array(), 'style' => array()), 'i' => array('id' => array(), 'class' => array(), 'style' => array()), 'br' => array('id' => array(), 'class' => array(), 'style' => array()))

KSES configuration for label tags.

Tags
link

wp_kses()

since
0.0.1
since
3.4.0

Added support for <br> and <span> elements.

$kses_p

KSES P

public static array<string|int, mixed> $kses_p = array('span' => array('id' => array(), 'class' => array(), 'style' => array()), 'a' => array('id' => array(), 'class' => array(), 'style' => array(), 'href' => array(), 'title' => array(), 'target' => array(), 'rel' => array()), 'em' => array('id' => array(), 'class' => array(), 'style' => array()), 'strong' => array('id' => array(), 'class' => array(), 'style' => array()), 'code' => array('id' => array(), 'class' => array(), 'style' => array()), 'i' => array('id' => array(), 'class' => array(), 'style' => array()), 'br' => array('id' => array(), 'class' => array(), 'style' => array()))

KSES configuration for paragraph tags.

Tags
link

wp_kses()

since
0.0.1
since
3.4.0

Added support for <span> elements.

$errors

Errors

protected array<string|int, mixed> $errors = array()

The array of all errors on the instance.

Tags
since
2.0.0

$plugin_dependencies

Plugin Dependencies

protected array<string|int, mixed> $plugin_dependencies = array()

Example: array( 'key' => 'classic-editor/classic-editor.php', // The key will be passed to is_plugin_active() to check. 'name' => _x( 'Classic Editor', 'plugin dependency - classic editor', 'wp_backstage' ), 'url' => 'https://wordpress.org/plugins/classic-editor/', )

The array of all errors on the instance.

Tags
link

is_plugin_active()

since
2.0.0

Methods

__construct()

Construct

public __construct() : void
Tags
since
2.0.0
since
3.7.0

Removes plugin dependencies.

Return values
void

ajax_render_media()

Ajax Render Media

public ajax_render_media() : void

This method is responsible for providing the ajax response for the media uploader preview.

Tags
since
3.3.0
Return values
void

enqueue_admin_scripts()

Enqueue Admin Scripts

public enqueue_admin_scripts() : void

Conditionally enqueue required scripts and styles. This handles enqueues for the media uploader, WP editor, and color picker. This is also responsible for loading up jQuery UI Core and required jQuery UI widgets like the date picker and sortable. Finally, this will initialize all code editor instances.

Tags
link

wp_enqueue_script()

link

wp_enqueue_style()

link

wp_add_inline_script()

link

wp_enqueue_editor()

link

wp_enqueue_media()

link

did_action()

link

hook: admin_enqueue_scripts

link

Including CSS and Javascript in WP

since
0.0.1
Return values
void

has_errors()

Has Errors

public has_errors() : bool

A utility method to easily check if the instance has errors or not.

Tags
since
2.0.0
Return values
bool

Whether the instance has errors or not.

init()

Init

public init() : void

Hook all methods to WordPress.

Tags
link

add_action()

link

hook: admin_print_styles

link

hook: admin_print_scripts

link

hook: admin_enqueue_scripts

link

hook: admin_print_footer_scripts

link

hook: admin_print_footer_scripts-{$hook_suffix}

link

WP Actions

link

WP Filters

since
0.0.1
since
3.4.0

Adds filter to disable block editor for widgets.

since
3.7.0

Removes filter to disable block editor for widgets.

since
3.7.2

Moves code editor inline script to priority 20 to solve customizer "Additional CSS" panel bug.

Return values
void

inline_address_script()

Inline Address Script

public inline_address_script() : void

Inlines the address script.

Tags
since
0.0.1
since
2.0.0

Added methods to global wpBackstage object.

Return values
void

inline_code_editor_script()

Inline Code Editor Script

public inline_code_editor_script() : void

Inlines the code editor script. All of the initializer functions fire at window load, to ensure that all CodeMirror instances have finished initializing first.

Tags
link

wp_enqueue_code_editor()

link

CodeMirror in WP

link

CodeMirror

link

Default Scripts Included by WP

link

WP Javascript Reference

since
0.0.1
since
2.0.0

Added methods to global wpBackstage object.

Return values
void

inline_code_editor_style()

Inline Code Editor Style

public inline_code_editor_style() : void

Inlines the code editor field style.

Tags
since
2.0.0
Return values
void

inline_customizer_style()

Inline customizer Style

public inline_customizer_style() : void

Inlines the customizer style.

Tags
since
2.0.0
Return values
void

inline_editor_style()

Inline Editor Style

public inline_editor_style() : void

Inlines the editor field style.

Tags
since
0.0.1
Return values
void

inline_global_script()

Inline Global Script

public inline_global_script() : void

Inlines the script that initializes the global wpBackstage JavaScript object.

Tags
since
2.0.0
Return values
void

inline_global_style()

Inline Global Style

public inline_global_style() : void
Tags
since
3.1.0
Return values
void

inline_media_mixin_overrides_script()

Inline Media Mixin Overrides Script

public inline_media_mixin_overrides_script() : void

This method is responsible for outputting a script that makes a small override to the native WordPress wp.media.mixin.removeAllPlayers() mixin. By default, WordPress kills all media elements when one is rendered in the WordPress media modal, with no way to ignore that behavior. The side effect of this is that media elements in the WP Admin are killed when selecting an audio or video attachment in the media uploader. Because WP Backstage uses WordPress media elements on audio and video previews in the media uploader fields, it is necessary to provide a way to ignore these in this function. This function was copied from /wp-includes/js/media-audiovideo.js, and adds a simple check for a wp-mediaelement-keep class to ignore removal.

Tags
since
3.3.0
Return values
void

inline_media_uploader_style()

Inline Media Uploader Style

public inline_media_uploader_style() : void

Inlines the media uploader field style.

Tags
since
2.0.0
since
3.3.0

Adds styles for new media uploader preview rendering.

Return values
void

inline_nav_menu_item_script()

Inline Nav Menu Item Script

public inline_nav_menu_item_script() : void
Tags
since
2.0.0
since
3.4.1

Only renders the script on the "Edit Menus" page and bails on the "Manage Locations" and "Add New" page.

Return values
void

inline_options_script()

Inline Options Script

public inline_options_script() : void
Tags
since
2.0.0
Return values
void

inline_post_type_script()

Inline Post Type Script

public inline_post_type_script() : void
Tags
since
2.0.0
since
3.4.0

Adds support for block editor.

Return values
void

inline_rest_api_preview_code_editor_script()

Inline REST API Preview Code Editor Script

public inline_rest_api_preview_code_editor_script() : void

This method inlines the CodeMirror settings for the RESP API preview, so that it is available when the REST API preview script needs it.

Tags
since
3.4.0
Return values
void

inline_taxonomy_script()

Inline Taxonomy Script

public inline_taxonomy_script() : void
Tags
since
0.0.1
Return values
void

inline_thumbnail_column_style()

Inline Thumbnail Column Style

public inline_thumbnail_column_style() : void
Tags
since
0.0.1
Return values
void

inline_user_script()

Inline User Script

public inline_user_script() : void
Tags
since
2.0.0
Return values
void

inline_widget_script()

Inline Widget Script

public inline_widget_script() : void
Tags
since
2.0.0
since
3.7.0

Refactors to use the jQuery events for widget-added and widget-updated for support accross legacy, customizer, and block editing screens.

Return values
void

render_media_item()

Render Media Item

public render_media_item(int $attachment_id[, bool $is_multiple = false ]) : void

This method is responsible for rendering a single media item for use in the media uploader field. Taking into account whether the media uploader is rendering multiple items or not, and then taking into account the mime type of the attachment, render a media element. If

Parameters
$attachment_id : int

The ID of the attachment to render.

$is_multiple : bool = false

Whether the media uploader allows multiple attachments or not.

Tags
since
3.3.0
Return values
void

is_plugin_active()

Is Plugin Active

protected is_plugin_active(string $plugin) : bool

The native is_plugin_active() function in WordPress does not exist at the time this class is constructed. This function checks against the active_plugins option in the database.

Parameters
$plugin : string

The plugin file name as classic-editor/classic-editor.php.

Tags
link

is_plugin_active()

since
2.0.0
Return values
bool

Search results