Skip to content

Commit

Permalink
See pewresearch/pewresearch-org@427080f from refs/heads/release/5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
prcdevgitbot committed Feb 14, 2024
1 parent 3fb812f commit 60329ea
Show file tree
Hide file tree
Showing 17 changed files with 157 additions and 84 deletions.
6 changes: 1 addition & 5 deletions includes/datasets/build/download-block/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"title": "Dataset Download",
"category": "theme",
"description": "This block allows you to download the specified dataset. First it checks for user accounts credentials and then it provides a download button.",
"attributes": {
"termId": {
"type": "number"
}
},
"attributes": {},
"supports": {
"anchor": true,
"html": false,
Expand Down
2 changes: 1 addition & 1 deletion includes/datasets/build/download-block/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('classnames', 'prc-block-utils', 'prc-icons', 'react', 'wp-block-editor', 'wp-blocks', 'wp-element', 'wp-polyfill', 'wp-primitives'), 'version' => '25f7ea4c85aa20b945c3');
<?php return array('dependencies' => array('classnames', 'prc-block-utils', 'prc-icons', 'react', 'wp-block-editor', 'wp-blocks', 'wp-element', 'wp-polyfill', 'wp-primitives'), 'version' => 'db454abce4cf02bbbcf9');
2 changes: 1 addition & 1 deletion includes/datasets/build/download-block/index.js

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

2 changes: 1 addition & 1 deletion includes/datasets/build/download-block/index.js.map

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

19 changes: 12 additions & 7 deletions includes/datasets/build/download-block/render.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
<?php
namespace PRC\Platform\Facets;
namespace PRC\Platform\Datasets;

$target_namespace = array_key_exists('interactiveNamespace', $attributes) ? $attributes['interactiveNamespace'] : null;
wp_enqueue_script('wp-url');
wp_enqueue_script('wp-api-fetch');

$dataset_term_id = $attributes['termId'];
// We need to get some term meta... like if this is atp or not.
$is_atp = false;
// we need to get the tt_id for the dataset term... or the post id if this is a singular dataset.
$dataset_id = get_the_ID();
if ( is_tax('datasets') ) {
$dataset_term_id = get_queried_object_id();
$dataset = \TDS\get_related_post($dataset_term_id, 'datasets');
$dataset_id = $dataset->ID;
}
$is_atp = get_post_meta( $dataset_id, 'is_atp', true );

$block_wrapper_attrs = get_block_wrapper_attributes(array(
'data-wp-interactive' => wp_json_encode(array(
'namespace' => 'prc-platform/dataset-download'
)),
'data-wp-context' => wp_json_encode(array(
'targetNamespace' => $target_namespace,
'datasetTermId' => $dataset_term_id,
'datasetId' => $dataset_id,
'isATP' => $is_atp,
)),
));
Expand Down
2 changes: 1 addition & 1 deletion includes/datasets/build/download-block/view.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('@wordpress/interactivity', 'wp-polyfill'), 'version' => '3ea7ab686d6c283edee8', 'type' => 'module');
<?php return array('dependencies' => array('@wordpress/interactivity', 'wp-polyfill'), 'version' => '5c0b84b351d1e299b139', 'type' => 'module');
Loading

0 comments on commit 60329ea

Please sign in to comment.