Skip to content

Commit 09dc644

Browse files
authored
release: new version
- Adds Template Cloud integration
2 parents 5c132f6 + 6ee8359 commit 09dc644

File tree

16 files changed

+1507
-82
lines changed

16 files changed

+1507
-82
lines changed

inc/class-main.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function init() {
4848
}
4949

5050
add_filter( 'otter_blocks_about_us_metadata', array( $this, 'about_page' ) );
51-
51+
5252
add_action( 'parse_query', array( $this, 'pagination_support' ) );
5353
}
5454

@@ -83,6 +83,8 @@ public function autoload_classes() {
8383
'\ThemeIsle\GutenbergBlocks\Integration\Form_Email',
8484
'\ThemeIsle\GutenbergBlocks\Server\Form_Server',
8585
'\ThemeIsle\GutenbergBlocks\Server\Prompt_Server',
86+
'\ThemeIsle\GutenbergBlocks\Plugins\Template_Cloud',
87+
'\ThemeIsle\GutenbergBlocks\Server\Template_Cloud_Server',
8688
);
8789

8890
$classnames = apply_filters( 'otter_blocks_autoloader', $classnames );
@@ -532,13 +534,13 @@ public function generate_svg_attachment_metadata( $metadata, $attachment_id ) {
532534

533535
/**
534536
* Disable canonical redirect to make Posts pagination feature work.
535-
*
537+
*
536538
* @param \WP_Query $request The query object.
537539
*/
538540
public function pagination_support( $request ) {
539541
if (
540-
true === $request->is_singular &&
541-
-1 === $request->current_post &&
542+
true === $request->is_singular &&
543+
-1 === $request->current_post &&
542544
true === $request->is_paged &&
543545
(
544546
! empty( $request->query_vars['page'] ) ||

inc/plugins/class-dashboard.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function register_menu_page() {
6060
/**
6161
* Add shortcut to the Blocks tab in Dashboard.
6262
*/
63-
63+
6464

6565
add_submenu_page(
6666
'otter',
@@ -122,7 +122,7 @@ public function add_inline_css() {
122122
}
123123
</style>
124124
<?php
125-
125+
126126
}
127127

128128
/**
@@ -222,7 +222,7 @@ public function enqueue_options_assets() {
222222

223223
/**
224224
* Get the dashboard data to store in global object.
225-
*
225+
*
226226
* @return array
227227
*/
228228
public function get_dashboard_data() {
@@ -236,6 +236,9 @@ public function get_dashboard_data() {
236236
'stylesExist' => is_dir( $basedir ) || boolval( get_transient( 'otter_animations_parsed' ) ),
237237
'hasPro' => Pro::is_pro_installed(),
238238
'upgradeLink' => tsdk_translate_link( tsdk_utmify( Pro::get_url(), 'options', Pro::get_reference() ) ),
239+
'upgradeLinkFromTc' => tsdk_utmify( Pro::get_url(), 'templatecloud' ),
240+
'tcUpgradeLink' => tsdk_utmify( 'https://themeisle.com/plugins/templates-cloud/', 'templatecloud', 'otter-blocks' ),
241+
'tcDocs' => 'https://docs.themeisle.com/article/2191-templates-cloud-collections',
239242
'docsLink' => Pro::get_docs_url(),
240243
'showFeedbackNotice' => $this->should_show_feedback_notice(),
241244
'deal' => ! Pro::is_pro_installed() ? $offer->get_localized_data() : array(),

inc/plugins/class-options-settings.php

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
namespace ThemeIsle\GutenbergBlocks\Plugins;
99

10+
use ThemeIsle\GutenbergBlocks\Server\Template_Cloud_Server;
11+
use ThemeIsle\GutenbergBlocks\Plugins\Template_Cloud;
12+
1013
/**
1114
* Class Options_Settings
1215
*/
@@ -756,7 +759,7 @@ function ( $item ) {
756759
'default' => true,
757760
)
758761
);
759-
762+
760763
register_setting(
761764
'themeisle_blocks_settings',
762765
'themeisle_blocks_settings_prompt_actions',
@@ -813,6 +816,37 @@ function( $item ) {
813816
),
814817
)
815818
);
819+
820+
821+
register_setting(
822+
'themeisle_blocks_settings',
823+
Template_Cloud::SOURCES_SETTING_KEY,
824+
array(
825+
'type' => 'array',
826+
'description' => __( 'The template cloud sources from which patterns will be loaded.', 'otter-blocks' ),
827+
'sanitize_callback' => [ Template_Cloud_Server::class, 'sanitize_template_cloud_sources' ],
828+
'show_in_rest' => array(
829+
'schema' => array(
830+
'type' => 'array',
831+
'items' => array(
832+
'type' => 'object',
833+
'properties' => array(
834+
'key' => array(
835+
'type' => 'string',
836+
),
837+
'url' => array(
838+
'type' => 'string',
839+
),
840+
'name' => array(
841+
'type' => 'string',
842+
),
843+
),
844+
),
845+
),
846+
),
847+
'default' => [],
848+
)
849+
);
816850
}
817851

818852
/**

0 commit comments

Comments
 (0)