Skip to content

Commit 8265524

Browse files
remove pattern registration
1 parent ba5035f commit 8265524

File tree

1 file changed

+0
-65
lines changed

1 file changed

+0
-65
lines changed

src/design-library/init.php

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public function __construct() {
3131

3232
add_filter( 'stackable_design_library_get_premium_designs', array( $this, 'get_designs_with_disabled_blocks' ) );
3333
add_filter( 'stackable_design_library_get_premium_designs', array( $this, 'get_premium_designs' ) );
34-
add_action( 'init', array( $this, 'register_design_pattern' ) );
3534
add_action( 'stackable_delete_design_library_cache', array( $this, 'delete_cache_v3' ) );
3635
}
3736

@@ -109,24 +108,10 @@ public function delete_cache_v3() {
109108
}
110109

111110
public function delete_cache() {
112-
$designs = $this->get_design_library_from_cloud();
113-
114-
$library = $designs[ self::API_VERSION ];
115-
foreach ( $library as $design_id => $design ) {
116-
if ( WP_Block_Patterns_Registry::get_instance()->is_registered( 'stackable_' . $design_id ) ) {
117-
$res = unregister_block_pattern( 'stackable_' . $design_id );
118-
}
119-
120-
if ( WP_Block_Pattern_Categories_Registry::get_instance()->is_registered( 'stackable_' . $design[ 'category' ] ) ) {
121-
$res = unregister_block_pattern_category( 'stackable_' . $design[ 'category' ] );
122-
}
123-
}
124111
// Delete design library.
125112
delete_transient( 'stackable_get_design_library_v4' );
126113
delete_transient( 'stackable_get_design_library_json_v4' );
127114

128-
$this->register_design_pattern();
129-
130115
do_action( 'stackable_delete_design_library_cache' );
131116
}
132117

@@ -443,56 +428,6 @@ public function get_template_with_placeholders( $template, $category ) {
443428
return $template;
444429
}
445430

446-
public function register_design_pattern() {
447-
$designs = $this->get_design_library_from_cloud();
448-
449-
$library = $designs[ self::API_VERSION ];
450-
451-
if ( ! $library ) {
452-
return;
453-
}
454-
455-
456-
$disabled_blocks = $this->get_disabled_blocks();
457-
458-
459-
if ( ! WP_Block_Pattern_Categories_Registry::get_instance()->is_registered( 'stackable' ) ) {
460-
register_block_pattern_category( 'stackable', [
461-
'label' => __( 'Stackable', STACKABLE_I18N ),
462-
'description' => __( 'Patterns for Stackable Design Library', STACKABLE_I18N ),
463-
] );
464-
}
465-
466-
foreach ( $library as $design_id => $design ) {
467-
if ( $design[ 'plan' ] === 'premium' && ( STACKABLE_BUILD === 'free' || ! sugb_fs()->can_use_premium_code() ) ) {
468-
continue;
469-
}
470-
471-
if ( $disabled_blocks ) {
472-
$has_disabled = $this->check_for_disabled_block( $design[ 'template' ], $disabled_blocks );
473-
if ( $has_disabled ) continue;
474-
}
475-
476-
register_block_pattern_category( 'stackable_' . $this->get_category_kebab_case( $design[ 'category' ] ), [
477-
'label' => sprintf( __( 'Stackable %s', STACKABLE_I18N ), $design[ 'category' ] ),
478-
'description' => sprintf( __( '%s patterns for Stackable Design Library', STACKABLE_I18N ), $design[ 'category' ] ),
479-
] );
480-
481-
register_block_pattern(
482-
'stackable_' . $design_id,
483-
array(
484-
'title' => sprintf( __( 'Stackable %s', STACKABLE_I18N ), $design[ 'label' ] ),
485-
'content' => $this->get_template_with_placeholders( $design[ 'template' ], $design[ 'category' ] ),
486-
'categories' => array( 'stackable_' . $this->get_category_kebab_case( $design[ 'category' ] ), 'stackable' ), // used in Patterns
487-
'category' => $design[ 'category' ], // used in Design Library
488-
'description' => $design[ 'description' ],
489-
'plan' => $design[ 'plan' ],
490-
'designId' => $design_id
491-
)
492-
);
493-
}
494-
}
495-
496431
/**
497432
* Gets the URL of the CDN where to load our design library data. When
498433
* developer mode for the design library is turned on, the URL of the

0 commit comments

Comments
 (0)