__( 'Alert Box', 'alert-box-block' ), 'labels' => [ 'name' => __( 'Alert Boxes', 'alert-box-block' ), 'singular_name' => __( 'Alert Box', 'alert-box-block' ), 'add_new_item' => __( 'Add New Alert Box', 'alert-box-block' ), 'edit_item' => __( 'Edit Alert Box', 'alert-box-block' ), 'new_item' => __( 'New Alert Box', 'alert-box-block' ), 'all_items' => __( 'All Alert Boxes', 'alert-box-block' ), 'menu_name' => __( 'Alert Box', 'alert-box-block' ), ], 'public' => false, 'show_ui' => true, 'show_in_menu' => true, 'show_in_rest' => true, 'exclude_from_search' => true, 'publicly_queryable' => false, 'has_archive' => false, 'rewrite' => false, 'menu_icon' => 'dashicons-warning', 'menu_position' => 25, 'supports' => [ 'title', 'editor', 'custom-fields' ], 'template' => [ [ 'abb/alert-box' ] ], 'template_lock' => 'all', ] ); } /** * Keep this CPT to exactly one alert block. * * Free: 'all' — the single Alert Box can't be removed, moved or * surrounded by other blocks. * Pro: 'insert' — still no extra blocks, but the "Alert Block" picker * (src/admin/promo/BlockPicker.js) may swap the one block for any Pro * block. 'all' would make WordPress flag a swapped block as "doesn't * match the template"; 'insert' skips that check. */ public function lockTemplate( $settings, $context ) { if ( ! empty( $context->post ) && self::POST_TYPE === $context->post->post_type ) { $settings['templateLock'] = alertboxblock_is_premium() ? 'insert' : 'all'; } return $settings; } } }