Astra_Ext_Advanced_Hooks_Meta::admin_scripts()
Enqueue admin Scripts and Styles.
Description
Source
File: addons/advanced-hooks/classes/class-astra-ext-advanced-hooks-meta.php
public function admin_scripts() {
global $post;
global $pagenow;
$screen = get_current_screen();
if ( ( 'post-new.php' == $pagenow || 'post.php' == $pagenow ) && ASTRA_ADVANCED_HOOKS_POST_TYPE == $screen->post_type && ( isset( $_GET['code_editor'] ) || ( isset( $post->ID ) && 'code_editor' == get_post_meta( $post->ID, 'editor_type', true ) ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( ! function_exists( 'wp_enqueue_code_editor' ) || isset( $_GET['wordpress_editor'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
return;
}
$settings = wp_enqueue_code_editor(
array(
'type' => 'application/x-httpd-php',
'codemirror' => array(
'indentUnit' => 2,
'tabSize' => 2,
),
)
);
wp_add_inline_script(
'code-editor',
sprintf(
'jQuery( function() { wp.codeEditor.initialize( "ast-advanced-hook-php-code", %s ); } );',
wp_json_encode( $settings )
)
);
}
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 1.0.3 | Introduced. |