Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ingeniumed committed Feb 21, 2025
2 parents 9c64a35 + f920e79 commit 486c84e
Show file tree
Hide file tree
Showing 69 changed files with 2,801 additions and 1,287 deletions.
63 changes: 30 additions & 33 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/extending/block-registration.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ The render query is executed when the block is rendered and fetches the data tha

### `selection_queries`: array (optional)

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:
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:

- `display_name`: A human-friendly name for the selection query.
- `query` (required): An instance of `QueryInterface` that fetches the data.
Expand Down
5 changes: 5 additions & 0 deletions inc/Config/QueryRunner/QueryRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ public function execute( HttpQueryInterface $query, array $input_variables ): ar
if ( ! array_key_exists( $key, $input_variables ) && isset( $schema['default_value'] ) ) {
$input_variables[ $key ] = $schema['default_value'];
}

// If the input variable is required and not provided, return an error.
if ( ! array_key_exists( $key, $input_variables ) && isset( $schema['required'] ) && $schema['required'] ) {
return new WP_Error( 'remote-data-blocks-missing-required-input-variable', sprintf( 'Missing required input variable: %s', $key ) );
}
}

$raw_response_data = $this->get_raw_response_data( $query, $input_variables );
Expand Down
4 changes: 2 additions & 2 deletions inc/Editor/BlockManagement/BlockRegistration.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

use RemoteDataBlocks\Analytics\TracksAnalytics;
use RemoteDataBlocks\Telemetry\TracksTelemetry;
use RemoteDataBlocks\Editor\BlockPatterns\BlockPatterns;
use RemoteDataBlocks\Editor\DataBinding\BlockBindings;
use RemoteDataBlocks\REST\RemoteDataController;
Expand Down Expand Up @@ -54,7 +54,7 @@ public static function register_container_blocks(): void {
wp_localize_script( $script_handle, 'REMOTE_DATA_BLOCKS', [
'config' => $all_remote_block_configs,
'rest_url' => RemoteDataController::get_url(),
'tracks_global_properties' => TracksAnalytics::get_global_properties(),
'tracks_global_properties' => TracksTelemetry::get_global_properties(),
] );
}
}
Expand Down
13 changes: 5 additions & 8 deletions inc/Integrations/Airtable/AirtableIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace RemoteDataBlocks\Integrations\Airtable;

use RemoteDataBlocks\WpdbStorage\DataSourceCrud;
use RemoteDataBlocks\Store\DataSource\DataSourceConfigManager;
use RemoteDataBlocks\Config\Query\HttpQuery;
use RemoteDataBlocks\Formatting\StringFormatter;
use RemoteDataBlocks\Snippet\Snippet;
Expand All @@ -14,17 +14,14 @@ public static function init(): void {
}

public static function register_blocks(): void {
$data_source_configs = DataSourceCrud::get_configs_by_service(
REMOTE_DATA_BLOCKS_AIRTABLE_SERVICE
);
$data_source_configs = DataSourceConfigManager::get_all( [
'service' => REMOTE_DATA_BLOCKS_AIRTABLE_SERVICE,
'enable_blocks' => true,
] );

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

if ( false === ( $config['service_config']['enable_blocks'] ?? true ) ) {
continue;
}

self::register_blocks_for_airtable_data_source( $data_source );
self::register_loop_blocks_for_airtable_data_source( $data_source );
}
Expand Down
15 changes: 6 additions & 9 deletions inc/Integrations/Google/Sheets/GoogleSheetsIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace RemoteDataBlocks\Integrations\Google\Sheets;

use RemoteDataBlocks\WpdbStorage\DataSourceCrud;
use RemoteDataBlocks\Store\DataSource\DataSourceConfigManager;
use RemoteDataBlocks\Config\Query\HttpQuery;
use RemoteDataBlocks\Formatting\StringFormatter;
use RemoteDataBlocks\Snippet\Snippet;
Expand All @@ -14,17 +14,14 @@ public static function init(): void {
}

public static function register_blocks(): void {
$data_source_configs = DataSourceCrud::get_configs_by_service(
REMOTE_DATA_BLOCKS_GOOGLE_SHEETS_SERVICE
);
$data_source_configs = DataSourceConfigManager::get_all( [
'service' => REMOTE_DATA_BLOCKS_GOOGLE_SHEETS_SERVICE,
'enable_blocks' => true,
] );

foreach ( $data_source_configs as $config ) {
$data_source = GoogleSheetsDataSource::from_array( $config );

if ( false === ( $config['service_config']['enable_blocks'] ?? true ) ) {
continue;
}


self::register_blocks_for_google_sheets_data_source( $data_source );
self::register_loop_blocks_for_google_sheets_data_source( $data_source );
}
Expand Down
Loading

0 comments on commit 486c84e

Please sign in to comment.