Skip to content

Commit 486c84e

Browse files
committed
Fix merge conflicts
2 parents 9c64a35 + f920e79 commit 486c84e

File tree

69 files changed

+2801
-1287
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2801
-1287
lines changed

composer.lock

Lines changed: 30 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/extending/block-registration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ The render query is executed when the block is rendered and fetches the data tha
7070

7171
### `selection_queries`: array (optional)
7272

73-
Selection queries are used by content creators to select or curate remote data in the block editor. For example, you may wish to provide a list of products to users and allow them to select one to incled, or you may want to allow a user to search for a specific item. Selection queries are an array of objects with the following properties:
73+
Selection queries are used by content creators to select or curate remote data in the block editor. For example, you may wish to provide a list of products to users and allow them to select one to include in their post, or you may want to allow a user to search for a specific item. Selection queries are an array of objects with the following properties:
7474

7575
- `display_name`: A human-friendly name for the selection query.
7676
- `query` (required): An instance of `QueryInterface` that fetches the data.

inc/Config/QueryRunner/QueryRunner.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ public function execute( HttpQueryInterface $query, array $input_variables ): ar
203203
if ( ! array_key_exists( $key, $input_variables ) && isset( $schema['default_value'] ) ) {
204204
$input_variables[ $key ] = $schema['default_value'];
205205
}
206+
207+
// If the input variable is required and not provided, return an error.
208+
if ( ! array_key_exists( $key, $input_variables ) && isset( $schema['required'] ) && $schema['required'] ) {
209+
return new WP_Error( 'remote-data-blocks-missing-required-input-variable', sprintf( 'Missing required input variable: %s', $key ) );
210+
}
206211
}
207212

208213
$raw_response_data = $this->get_raw_response_data( $query, $input_variables );

inc/Editor/BlockManagement/BlockRegistration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
defined( 'ABSPATH' ) || exit();
66

7-
use RemoteDataBlocks\Analytics\TracksAnalytics;
7+
use RemoteDataBlocks\Telemetry\TracksTelemetry;
88
use RemoteDataBlocks\Editor\BlockPatterns\BlockPatterns;
99
use RemoteDataBlocks\Editor\DataBinding\BlockBindings;
1010
use RemoteDataBlocks\REST\RemoteDataController;
@@ -54,7 +54,7 @@ public static function register_container_blocks(): void {
5454
wp_localize_script( $script_handle, 'REMOTE_DATA_BLOCKS', [
5555
'config' => $all_remote_block_configs,
5656
'rest_url' => RemoteDataController::get_url(),
57-
'tracks_global_properties' => TracksAnalytics::get_global_properties(),
57+
'tracks_global_properties' => TracksTelemetry::get_global_properties(),
5858
] );
5959
}
6060
}

inc/Integrations/Airtable/AirtableIntegration.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace RemoteDataBlocks\Integrations\Airtable;
44

5-
use RemoteDataBlocks\WpdbStorage\DataSourceCrud;
5+
use RemoteDataBlocks\Store\DataSource\DataSourceConfigManager;
66
use RemoteDataBlocks\Config\Query\HttpQuery;
77
use RemoteDataBlocks\Formatting\StringFormatter;
88
use RemoteDataBlocks\Snippet\Snippet;
@@ -14,17 +14,14 @@ public static function init(): void {
1414
}
1515

1616
public static function register_blocks(): void {
17-
$data_source_configs = DataSourceCrud::get_configs_by_service(
18-
REMOTE_DATA_BLOCKS_AIRTABLE_SERVICE
19-
);
17+
$data_source_configs = DataSourceConfigManager::get_all( [
18+
'service' => REMOTE_DATA_BLOCKS_AIRTABLE_SERVICE,
19+
'enable_blocks' => true,
20+
] );
2021

2122
foreach ( $data_source_configs as $config ) {
2223
$data_source = AirtableDataSource::from_array( $config );
2324

24-
if ( false === ( $config['service_config']['enable_blocks'] ?? true ) ) {
25-
continue;
26-
}
27-
2825
self::register_blocks_for_airtable_data_source( $data_source );
2926
self::register_loop_blocks_for_airtable_data_source( $data_source );
3027
}

inc/Integrations/Google/Sheets/GoogleSheetsIntegration.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace RemoteDataBlocks\Integrations\Google\Sheets;
44

5-
use RemoteDataBlocks\WpdbStorage\DataSourceCrud;
5+
use RemoteDataBlocks\Store\DataSource\DataSourceConfigManager;
66
use RemoteDataBlocks\Config\Query\HttpQuery;
77
use RemoteDataBlocks\Formatting\StringFormatter;
88
use RemoteDataBlocks\Snippet\Snippet;
@@ -14,17 +14,14 @@ public static function init(): void {
1414
}
1515

1616
public static function register_blocks(): void {
17-
$data_source_configs = DataSourceCrud::get_configs_by_service(
18-
REMOTE_DATA_BLOCKS_GOOGLE_SHEETS_SERVICE
19-
);
17+
$data_source_configs = DataSourceConfigManager::get_all( [
18+
'service' => REMOTE_DATA_BLOCKS_GOOGLE_SHEETS_SERVICE,
19+
'enable_blocks' => true,
20+
] );
2021

2122
foreach ( $data_source_configs as $config ) {
2223
$data_source = GoogleSheetsDataSource::from_array( $config );
23-
24-
if ( false === ( $config['service_config']['enable_blocks'] ?? true ) ) {
25-
continue;
26-
}
27-
24+
2825
self::register_blocks_for_google_sheets_data_source( $data_source );
2926
self::register_loop_blocks_for_google_sheets_data_source( $data_source );
3027
}

0 commit comments

Comments
 (0)