Fixed Blocks Plugin Paths
This commit is contained in:
parent
389828ad7e
commit
fa5f7046dd
|
@ -429,7 +429,7 @@ abstract class AbstractBlock {
|
|||
'wcBlocksConfig',
|
||||
[
|
||||
'buildPhase' => Package::feature()->get_flag(),
|
||||
'pluginUrl' => plugins_url( '/', dirname( __DIR__ ) ),
|
||||
'pluginUrl' => plugins_url( '/', dirname( __DIR__, 2 ) ),
|
||||
'productCount' => array_sum( (array) wp_count_posts( 'product' ) ),
|
||||
'restApiRoutes' => [
|
||||
'/wc/store/v1' => array_keys( $this->get_routes_from_namespace( 'wc/store/v1' ) ),
|
||||
|
|
|
@ -353,7 +353,7 @@ class Checkout extends AbstractBlock {
|
|||
$declared_extensions['incompatible'],
|
||||
function( $acc, $item ) use ( $all_plugins ) {
|
||||
$plugin = $all_plugins[ $item ] ?? null;
|
||||
$plugin_id = $plugin['TextDomain'] ?? dirname( $item );
|
||||
$plugin_id = $plugin['TextDomain'] ?? dirname( $item, 2 );
|
||||
$plugin_name = $plugin['Name'] ?? $plugin_id;
|
||||
$acc[] = [
|
||||
'id' => $plugin_id,
|
||||
|
|
|
@ -112,7 +112,7 @@ class Package {
|
|||
$version = '11.8.0-dev';
|
||||
return new NewPackage(
|
||||
$version,
|
||||
dirname( __DIR__ ),
|
||||
dirname( __DIR__, 2 ),
|
||||
new FeatureGating()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class PatternsHelper {
|
|||
public static function get_image_url( array $images, int $index, string $default_image ): string {
|
||||
$image = filter_var( $default_image, FILTER_VALIDATE_URL )
|
||||
? $default_image
|
||||
: plugins_url( $default_image, dirname( __DIR__ ) );
|
||||
: plugins_url( $default_image, dirname( __DIR__, 2 ) );
|
||||
|
||||
if ( isset( $images[ $index ] ) ) {
|
||||
$image = $images[ $index ];
|
||||
|
|
|
@ -208,7 +208,7 @@ class ProductUpdater {
|
|||
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/image.php';
|
||||
|
||||
$product_image_id = media_sideload_image( plugins_url( $product_data['image'], dirname( __DIR__ ) ), $product->get_id(), $product_data['title'], 'id' );
|
||||
$product_image_id = media_sideload_image( plugins_url( $product_data['image'], dirname( __DIR__, 2 ) ), $product->get_id(), $product_data['title'], 'id' );
|
||||
if ( is_wp_error( $product_image_id ) ) {
|
||||
return new \WP_Error( 'error_uploading_image', $product_image_id->get_error_message() );
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ class ProductUpdater {
|
|||
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/image.php';
|
||||
|
||||
$product_image_id = media_sideload_image( plugins_url( self::DUMMY_PRODUCTS[ $i ]['image'], dirname( __DIR__ ) ), $product->get_id(), self::DUMMY_PRODUCTS[ $i ]['title'], 'id' );
|
||||
$product_image_id = media_sideload_image( plugins_url( self::DUMMY_PRODUCTS[ $i ]['image'], dirname( __DIR__, 2 ) ), $product->get_id(), self::DUMMY_PRODUCTS[ $i ]['title'], 'id' );
|
||||
$product_image_id = $product->set_image_id( $product_image_id );
|
||||
|
||||
$product->save();
|
||||
|
|
|
@ -293,7 +293,7 @@ class BlockTemplateUtils {
|
|||
* @return string
|
||||
*/
|
||||
public static function get_templates_directory( $template_type = 'wp_template' ) {
|
||||
$root_path = dirname( __DIR__, 2 ) . '/' . self::TEMPLATES_ROOT_DIR . DIRECTORY_SEPARATOR;
|
||||
$root_path = dirname( __DIR__, 3 ) . '/' . self::TEMPLATES_ROOT_DIR . DIRECTORY_SEPARATOR;
|
||||
$templates_directory = $root_path . self::DIRECTORY_NAMES['TEMPLATES'];
|
||||
$template_parts_directory = $root_path . self::DIRECTORY_NAMES['TEMPLATE_PARTS'];
|
||||
|
||||
|
|
Loading…
Reference in New Issue