diff --git a/gutenberg/blocks/hero/example.jpg b/gutenberg/blocks/hero/example.jpg index 9b9e76f..3c20114 100644 Binary files a/gutenberg/blocks/hero/example.jpg and b/gutenberg/blocks/hero/example.jpg differ diff --git a/gutenberg/blocks/image/view.latte b/gutenberg/blocks/image/view.latte index 8d1a68e..dbb5b86 100644 --- a/gutenberg/blocks/image/view.latte +++ b/gutenberg/blocks/image/view.latte @@ -1,16 +1,20 @@ -{if $link['url']} - -{/if} +{if !empty($image['src'])} -
- {tr_get_media($image, true)} - {if strlen($caption['text'])} -
- {$caption['text']} -
- {/if} -
+ {if $link['url']} +
+ {/if} + +
+ {tr_get_media($image, true)} + {if strlen($caption['text'])} +
+ {$caption['text']} +
+ {/if} +
+ + {if $link['url']} +
+ {/if} -{if $link['url']} - {/if} \ No newline at end of file diff --git a/php-inc/enqueue-block-specific-css-and-js.php b/php-inc/enqueue-block-specific-css-and-js.php index 56cb053..43a8cef 100644 --- a/php-inc/enqueue-block-specific-css-and-js.php +++ b/php-inc/enqueue-block-specific-css-and-js.php @@ -25,10 +25,12 @@ function tr_enqueue_block_specific_css_and_js() { function tr_parse_blocks($blocks, $block_prefix, &$tr_custom_blocks_names) { foreach ($blocks as $block) { - if (str_starts_with($block['blockName'], "$block_prefix/")) { + $block_name = $block['blockName']; + + if (!is_null($block_name) && str_starts_with($block_name, "$block_prefix/")) { - if (!in_array($block['blockName'], $tr_custom_blocks_names)) { - $tr_custom_blocks_names[] = $block['blockName']; + if (!in_array($block_name, $tr_custom_blocks_names)) { + $tr_custom_blocks_names[] = $block_name; // if nested blocks, parse them as well if (!empty($block['innerBlocks'])) { diff --git a/php-inc/theme-functions.php b/php-inc/theme-functions.php index a124db8..9cf6258 100644 --- a/php-inc/theme-functions.php +++ b/php-inc/theme-functions.php @@ -61,7 +61,7 @@ function tr_get_media( $path_only = false ) { - if ($media === NULL) { + if ($media === NULL || (is_array($media) && empty($media['src']))) { return false; } diff --git a/views/temp/blocks-image-view.latte--3c6059f16b.php b/views/temp/blocks-image-view.latte--3c6059f16b.php new file mode 100644 index 0000000..133b140 --- /dev/null +++ b/views/temp/blocks-image-view.latte--3c6059f16b.php @@ -0,0 +1,45 @@ + +'; + } + echo ' +
+ '; + echo LR\Filters::escapeHtmlText(tr_get_media($image, true)) /* line 8 */; + echo "\n"; + if (strlen($caption['text'])) /* line 9 */ { + echo '
+ '; + echo LR\Filters::escapeHtmlText($caption['text']) /* line 11 */; + echo ' +
+'; + } + echo '
+ +'; + if ($link['url']) /* line 16 */ { + echo ' +'; + } + echo "\n"; + } + } +} diff --git a/views/temp/blocks-image-view.latte--3c6059f16b.php.lock b/views/temp/blocks-image-view.latte--3c6059f16b.php.lock new file mode 100644 index 0000000..e69de29 diff --git a/views/temp/blocks-video-view.latte--b1ed077162.php b/views/temp/blocks-video-view.latte--b1ed077162.php new file mode 100644 index 0000000..5fb8a8f --- /dev/null +++ b/views/temp/blocks-video-view.latte--b1ed077162.php @@ -0,0 +1,71 @@ + +'; + $this->createTemplate(tr_part('video'), ['video_src' => $video_src, 'video_type' => tr_get_video_type_and_id($video_src)] + $this->params, 'include')->renderToContentType('html') /* line 19 */; + echo "\n"; + ob_start(fn() => ''); + try { + echo '
'; + ob_start(); + try { + echo ' + '; + echo $optional_caption['text'] /* line 25 */; + echo ' + '; + + } finally { + $ʟ_ifc[0] = rtrim(ob_get_flush()) === ''; + } + echo '
+'; + + } finally { + if ($ʟ_ifc[0] ?? null) { + ob_end_clean(); + } else { + echo ob_get_clean(); + } + } + echo ' +'; + } + } + + + public function prepare(): array + { + extract($this->params); + + $video_src = '' /* line 1 */; + if ($inspector_is_self_hosted['checked']) /* line 2 */ { + if ($self_hosted_video['src']) /* line 3 */ { + $video_src = $self_hosted_video['src'] /* line 4 */; + } + } else /* line 7 */ { + if ($yt_or_vimeo_url['text']) /* line 8 */ { + $video_src = $yt_or_vimeo_url['text'] /* line 9 */; + } + } + return get_defined_vars(); + } +} diff --git a/views/temp/blocks-video-view.latte--b1ed077162.php.lock b/views/temp/blocks-video-view.latte--b1ed077162.php.lock new file mode 100644 index 0000000..e69de29 diff --git a/views/temp/views-templates-page.latte--a15047f9f0.php b/views/temp/views-templates-page.latte--a15047f9f0.php new file mode 100644 index 0000000..654088f --- /dev/null +++ b/views/temp/views-templates-page.latte--a15047f9f0.php @@ -0,0 +1,40 @@ +createTemplate(tr_view_path('/layout/header'), $this->params, 'include')->renderToContentType('html') /* line 2 */; + echo ' +
+'; + while (have_posts()) /* line 5 */ { + echo ' '; + echo LR\Filters::escapeHtmlText(the_post()) /* line 6 */; + echo ' + +

'; + echo LR\Filters::escapeHtmlText(the_title()) /* line 8 */; + echo '

+
+ '; + echo LR\Filters::escapeHtmlText(the_content()) /* line 10 */; + echo ' + +'; + + } + echo '
+ +'; + $this->createTemplate(tr_view_path('/layout/footer'), $this->params, 'include')->renderToContentType('html') /* line 15 */; + } +} diff --git a/views/temp/views-templates-page.latte--a15047f9f0.php.lock b/views/temp/views-templates-page.latte--a15047f9f0.php.lock new file mode 100644 index 0000000..e69de29