queue_conflicting_styles() {
if ( ! PageController::is_admin_or_embed_page() ) {
return;
}
// Dequeing this to avoid conflicts, until we remove the 'woocommerce-page' class.
wp_dequeue_style( 'woocommerce-blocktheme' );
}
/**
* Update the edit product links when the new experience is enabled.
*
* @param string $link The edit link.
* @param int $post_id Post ID.
* @return string
*/
public function update_edit_product_link( $link, $post_id ) {
$product = wc_get_product( $post_id );
if ( ! $product ) {
return $link;
}
if ( $product->get_type() === 'simple' ) {
return admin_url( 'admin.php?page=wc-admin&path=/product/' . $product->get_id() );
}
return $link;
}
/**
* Enables variation post type in REST API.
*
* @param array $args Array of post type arguments.
* @return array Array of post type arguments.
*/
public function enable_rest_api_for_product_variation( $args ) {
$args['show_in_rest'] = true;
return $args;
}
/**
* Adds fields so that we can store user preferences for the variations block.
*
* @param array $user_data_fields User data fields.
* @return array
*/
public function add_user_data_fields( $user_data_fields ) {
return array_merge(
$user_data_fields,
array(
'variable_product_block_tour_shown',
'local_attributes_notice_dismissed_ids',
'variable_items_without_price_notice_dismissed',
'product_advice_card_dismissed',
)
);
}
/**
* Sets the current screen to the block editor if a wc-admin page.
*/
public function set_current_screen_to_block_editor_if_wc_admin() {
$screen = get_current_screen();
// phpcs:ignore Squiz.PHP.CommentedOutCode.Found
// (no idea why I need that phpcs:ignore above, but I'm tired trying to re-write this comment to get it to pass)
// we can't check the 'path' query param because client-side routing is used within wc-admin,
// so this action handler is only called on the initial page load from the server, which might
// not be the product edit page (it mostly likely isn't).
if ( PageController::is_admin_page() ) {
$screen->is_block_editor( true );
wp_add_inline_script(
'wp-blocks',
'wp.blocks && wp.blocks.unstable__bootstrapServerSideBlockDefinitions && wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
);
}
}
/**
* Get the product editor settings.
*/
private function get_product_editor_settings() {
$editor_settings['productTemplates'] = array_map(
function ( $product_template ) {
return $product_template->to_json();
},
$this->product_templates
);
$block_editor_context = new WP_Block_Editor_Context( array( 'name' => self::EDITOR_CONTEXT_NAME ) );
return get_block_editor_settings( $editor_settings, $block_editor_context );
}
/**
* Get default product templates.
*
* @return array The default templates.
*/
private function get_default_product_templates() {
$templates = array();
$templates[] = new ProductTemplate(
array(
'id' => 'standard-product-template',
'title' => __( 'Standard product', 'woocommerce' ),
'description' => __( 'A single physical or virtual product, e.g. a t-shirt or an eBook.', 'woocommerce' ),
'order' => 10,
'icon' => 'shipping',
'layout_template_id' => 'simple-product',
'product_data' => array(
'type' => 'simple',
),
)
);
$templates[] = new ProductTemplate(
array(
'id' => 'grouped-product-template',
'title' => __( 'Grouped product', 'woocommerce' ),
'description' => __( 'A set of products that go well together, e.g. camera kit.', 'woocommerce' ),
'order' => 20,
'icon' => 'group',
'layout_template_id' => 'simple-product',
'product_data' => array(
'type' => 'grouped',
),
)
);
$templates[] = new ProductTemplate(
array(
'id' => 'affiliate-product-template',
'title' => __( 'Affiliate product', 'woocommerce' ),
'description' => __( 'A link to a product sold on a different website, e.g. brand collab.', 'woocommerce' ),
'order' => 30,
'icon' => 'link',
'layout_template_id' => 'simple-product',
'product_data' => array(
'type' => 'external',
),
)
);
return $templates;
}
/**
* Create default product template by custom product type if it does not have a
* template associated yet.
*
* @param array $templates The registered product templates.
* @return array The new templates.
*/
private function create_default_product_template_by_custom_product_type( array $templates ) {
// Getting the product types registered via the classic editor.
$registered_product_types = wc_get_product_types();
$custom_product_types = array_filter(
$registered_product_types,
function ( $product_type ) {
return ! in_array( $product_type, $this->supported_product_types, true );
},
ARRAY_FILTER_USE_KEY
);
$templates_with_product_type = array_filter(
$templates,
function ( $template ) {
$product_data = $template->get_product_data();
return ! is_null( $product_data ) && array_key_exists( 'type', $product_data );
}
);
$custom_product_types_on_templates = array_map(
function ( $template ) {
$product_data = $template->get_product_data();
return $product_data['type'];
},
$templates_with_product_type
);
foreach ( $custom_product_types as $product_type => $title ) {
if ( in_array( $product_type, $custom_product_types_on_templates, true ) ) {
continue;
}
$templates[] = new ProductTemplate(
array(
'id' => $product_type . '-product-template',
'title' => $title,
'product_data' => array(
'type' => $product_type,
),
)
);
}
return $templates;
}
/**
* Register layout templates.
*/
public function register_layout_templates() {
$layout_template_registry = wc_get_container()->get( LayoutTemplateRegistry::class );
if ( ! $layout_template_registry->is_registered( 'simple-product' ) ) {
$layout_template_registry->register(
'simple-product',
'product-form',
SimpleProductTemplate::class
);
}
if ( ! $layout_template_registry->is_registered( 'product-variation' ) ) {
$layout_template_registry->register(
'product-variation',
'product-form',
ProductVariationTemplate::class
);
}
}
/**
* Register product templates.
*/
public function register_product_templates() {
/**
* Allows for new product template registration.
*
* @since 8.5.0
*/
$this->product_templates = apply_filters( 'woocommerce_product_editor_product_templates', $this->get_default_product_templates() );
$this->product_templates = $this->create_default_product_template_by_custom_product_type( $this->product_templates );
usort(
$this->product_templates,
function ( $a, $b ) {
return $a->get_order() - $b->get_order();
}
);
$this->redirection_controller->set_product_templates( $this->product_templates );
}
/**
* Register user metas.
*/
public function register_user_metas() {
register_rest_field(
'user',
'metaboxhidden_product',
array(
'get_callback' => function ( $object, $attr ) {
$hidden = get_user_meta( $object['id'], $attr, true );
if ( is_array( $hidden ) ) {
// Ensures to always return a string array.
return array_values( $hidden );
}
return array( 'postcustom' );
},
'update_callback' => function ( $value, $object, $attr ) {
// Update the field/meta value.
update_user_meta( $object->ID, $attr, $value );
},
'schema' => array(
'type' => 'array',
'description' => __( 'The metaboxhidden_product meta from the user metas.', 'woocommerce' ),
'items' => array(
'type' => 'string',
),
'arg_options' => array(
'sanitize_callback' => 'wp_parse_list',
'validate_callback' => 'rest_validate_request_arg',
),
),
)
);
}
}
Iphone XS Max AMA book case – alibabatelecom
View cart “Iphone 12 , 12 pro display DA quality” has been added to your cart.
Iphone XS Max AMA book case 279.57 €
AMA book case is the high-quality faux premuim case with built-in stand function and inside pockets for cards and documents.
inside of the case is silicone and it is not going broke when you lose your phone
It combines elegant colours and is equipped with a hard shell to ensure the stability and protection of your Smartphone.
iphone
Iphone XS MAX
Color
Dark bleu
Brand
AMA
6 in stock
Description
AMA book case is the high-quality faux premuim case with built-in stand function and inside pockets for cards and documents.
inside of the case is silicone and it is not going broke when you lose your phone
It combines elegant colours and is equipped with a hard shell to ensure the stability and protection of your Smartphone.