Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't assume plugins dir name to chatrix #205

Merged
merged 4 commits into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/Block/block.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ function register_site_status_test( string $block_json_path ) {
$badge = 'red';
}

$relative_path = str_replace( ABSPATH, '', $block_json_path );

add_filter(
'site_status_tests',
function ( array $tests ) use ( $label, $status, $badge ) {
function ( array $tests ) use ( $label, $status, $badge, $relative_path ) {
$tests['direct']['chatrix-block-json'] = array(
'label' => __( 'The block.json file exists', 'chatrix' ),
'test' => function () use ( $label, $status, $badge ) {
'test' => function () use ( $label, $status, $badge, $relative_path ) {
return array(
'label' => wp_kses_post( $label ),
'status' => $status,
Expand All @@ -80,7 +82,12 @@ function ( array $tests ) use ( $label, $status, $badge ) {
),
'description' =>
'<p>' .
__( 'If a block.json file is not found under wp-content/plugins/chatrix/build/block/block.json, the Chatrix block will not be available.', 'chatrix' ) .
sprintf(
/* translators: %1$s is the file name, %2$s is the file path */
__( 'If a %1$s file is not found under %2$s, the Chatrix block will not be available.', 'chatrix' ),
'<code>block.json</code>',
'<code>' . $relative_path . '</code>'
) .
'</p>',
'test' => 'chatrix-block-json',
);
Expand Down
2 changes: 1 addition & 1 deletion src/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ function () {
}

function root_url(): string {
return plugins_url() . '/chatrix/build';
return plugins_url( 'build', __DIR__ );
}