Skip to content

Commit

Permalink
See pewresearch/pewresearch-org@c47e250 from refs/heads/release/5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
prcdevgitbot committed Mar 10, 2024
1 parent 650649a commit 6eafaa6
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 15 deletions.
2 changes: 1 addition & 1 deletion blocks/collapsible/build/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@
"editorScript": "file:./index.js",
"style": "file:./style-index.css",
"render": "file:./render.php",
"viewModule": "file:./view.js"
"viewScriptModule": "file:./view.js"
}
2 changes: 1 addition & 1 deletion blocks/collapsible/build/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'), 'version' => 'eb9a0bfba21ab3ec6c8a');
<?php return array('dependencies' => array('classnames', 'prc-block-utils', 'prc-icons', 'react', 'wp-block-editor', 'wp-blocks', 'wp-element', 'wp-polyfill'), 'version' => 'adac3a8fa2e134c0e2ac');
2 changes: 1 addition & 1 deletion blocks/collapsible/build/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 blocks/collapsible/build/index.js.map

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions blocks/collapsible/build/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@
$collapsible_title = str_replace(["u003cstrongu003e", "u003c/strongu003e"], "", $collapsible_title);
$classname = array_key_exists('className', $attributes) ? $attributes['className'] : '';

$block_gap = \PRC\Platform\Block_Utils\get_block_gap_support_value($attributes);

if ( $is_deprecated ) {
$classname = $classname . ' is-style-plus';
}

$collapsible_id = sanitize_title($collapsible_title);

$wrapper_attrs = get_block_wrapper_attributes(array(
$block_wrapper_attrs = array(
'class' => $classname,
'id' => $collapsible_id,
'style' => '--block-gap: ' . \PRC\Platform\Block_Utils\get_block_gap_support_value($attributes),
'data-wp-interactive' => wp_json_encode(array(
'namespace' => 'prc-block/collapsible',
)),
Expand All @@ -27,13 +28,20 @@
)),
'data-wp-class--is-open' => 'context.isOpen',
'data-wp-init--scroll-into-view' => 'callbacks.onInitScrollIntoView',
));
);
if ( $block_gap ) {
$block_wrapper_attrs['style'] = '--block-gap: ' . $block_gap . ';';
}

$wrapper_attrs = get_block_wrapper_attributes($block_wrapper_attrs);

do_action('qm/debug', print_r($content, true));

if ( function_exists( 'apple_news_is_exporting' ) && apple_news_is_exporting() ) {
// echo wp_sprintf();
} else {
echo wp_sprintf(
'<div %1$s><div class="wp-block-prc-block-collapsible__title"><div>%2$s</div><button class="wp-block-prc-block-collapsible__icon" data-wp-on--click="actions.onClick"><i aria-hidden="true" class="fa-light fa-circle-plus"></i><i aria-hidden="true" class="fa-light fa-circle-minus"></i></button></div><div class="wp-block-prc-block-collapsible__content">%3$s</div></div>',
'<div %s><div class="wp-block-prc-block-collapsible__title"><div>%s</div><button class="wp-block-prc-block-collapsible__icon" data-wp-on--click="actions.onClick">+</button></div><div class="wp-block-prc-block-collapsible__content">%s</div></div>',
$wrapper_attrs,
esc_html($collapsible_title),
$content,
Expand Down
2 changes: 1 addition & 1 deletion blocks/collapsible/build/view.js.map

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

2 changes: 1 addition & 1 deletion blocks/collapsible/src/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,5 @@
"editorScript": "file:./index.js",
"style": "file:./style-index.css",
"render": "file:./render.php",
"viewModule": "file:./view.js"
"viewScriptModule": "file:./view.js"
}
16 changes: 12 additions & 4 deletions blocks/collapsible/src/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@
$collapsible_title = str_replace(["u003cstrongu003e", "u003c/strongu003e"], "", $collapsible_title);
$classname = array_key_exists('className', $attributes) ? $attributes['className'] : '';

$block_gap = \PRC\Platform\Block_Utils\get_block_gap_support_value($attributes);

if ( $is_deprecated ) {
$classname = $classname . ' is-style-plus';
}

$collapsible_id = sanitize_title($collapsible_title);

$wrapper_attrs = get_block_wrapper_attributes(array(
$block_wrapper_attrs = array(
'class' => $classname,
'id' => $collapsible_id,
'style' => '--block-gap: ' . \PRC\Platform\Block_Utils\get_block_gap_support_value($attributes),
'data-wp-interactive' => wp_json_encode(array(
'namespace' => 'prc-block/collapsible',
)),
Expand All @@ -27,13 +28,20 @@
)),
'data-wp-class--is-open' => 'context.isOpen',
'data-wp-init--scroll-into-view' => 'callbacks.onInitScrollIntoView',
));
);
if ( $block_gap ) {
$block_wrapper_attrs['style'] = '--block-gap: ' . $block_gap . ';';
}

$wrapper_attrs = get_block_wrapper_attributes($block_wrapper_attrs);

do_action('qm/debug', print_r($content, true));

if ( function_exists( 'apple_news_is_exporting' ) && apple_news_is_exporting() ) {
// echo wp_sprintf();
} else {
echo wp_sprintf(
'<div %1$s><div class="wp-block-prc-block-collapsible__title"><div>%2$s</div><button class="wp-block-prc-block-collapsible__icon" data-wp-on--click="actions.onClick"><i aria-hidden="true" class="fa-light fa-circle-plus"></i><i aria-hidden="true" class="fa-light fa-circle-minus"></i></button></div><div class="wp-block-prc-block-collapsible__content">%3$s</div></div>',
'<div %s><div class="wp-block-prc-block-collapsible__title"><div>%s</div><button class="wp-block-prc-block-collapsible__icon" data-wp-on--click="actions.onClick">+</button></div><div class="wp-block-prc-block-collapsible__content">%s</div></div>',
$wrapper_attrs,
esc_html($collapsible_title),
$content,
Expand Down
2 changes: 1 addition & 1 deletion blocks/table-of-contents/table-of-contents.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function render_block_callback( $attributes, $content, $block ) {
$return_top_level = false === $report_package->is_report_package( $post_id );
$chapters = $report_package->get_constructed_toc( $post_id );

if ( empty($chapters) ) {
if ( false === $chapters || empty($chapters) ) {
return;
}

Expand Down

0 comments on commit 6eafaa6

Please sign in to comment.