Skip to content
Snippets Groups Projects
Commit 79c5bec1 authored by Erick Hitter's avatar Erick Hitter
Browse files

Localize script with all configurable options.

parent 44797235
No related branches found
No related tags found
1 merge request!14Add native block-editor support
......@@ -180,20 +180,24 @@ class external_permalinks_redux {
return;
}
foreach ( $this->post_types as $post_type ) {
if (
function_exists( 'use_block_editor_for_post_type' )
&& use_block_editor_for_post_type( $post_type )
) {
return;
}
$this->post_types = array_flip( $this->post_types );
foreach ( array_keys( $this->post_types ) as $post_type ) {
$title = apply_filters( 'epr_metabox_title', '', $post_type );
if ( ! $title ) {
if ( empty( $title ) ) {
$title = __( 'External Permalinks Redux', 'external-permalinks-redux' );
}
$this->post_types[ $post_type ] = $title;
if (
function_exists( 'use_block_editor_for_post_type' )
&& use_block_editor_for_post_type( $post_type )
) {
continue;
}
add_meta_box( 'external-permalinks-redux', $title, array( $this, 'meta_box' ), $post_type, 'normal' );
unset( $title );
......
......@@ -66,5 +66,18 @@ class External_Permalinks_Redux_Block_Editor {
$asset_data['version'],
true
);
wp_localize_script(
$asset_handle,
'externalPermalinksReduxConfig',
array(
'metaKeys' => array(
'target' => external_permalinks_redux::get_instance()->meta_key_target,
'type' => external_permalinks_redux::get_instance()->meta_key_type,
),
'postTypes' => external_permalinks_redux::get_instance()->post_types,
'statusCodes' => external_permalinks_redux::get_instance()->status_codes,
)
);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment