From e6d0bbe2a1054b7de4206bb288b8e7ce54f1e02c Mon Sep 17 00:00:00 2001 From: Eric van der Vlist Date: Sat, 10 Oct 2026 22:02:17 +0200 Subject: [PATCH] Adaptation to work with wp-otherguise --- build/blocks-manifest.php | 20 +++++++++++++++++++- build/wp-attached-gpx/block.json | 20 +++++++++++++++++++- build/wp-attached-gpx/render.php | 5 ++++- src/wp-attached-gpx/block.json | 8 +++++++- src/wp-attached-gpx/render.php | 5 ++++- 5 files changed, 53 insertions(+), 5 deletions(-) diff --git a/build/blocks-manifest.php b/build/blocks-manifest.php index 3e38727..9cf7d33 100644 --- a/build/blocks-manifest.php +++ b/build/blocks-manifest.php @@ -21,6 +21,24 @@ return array( 'editorStyle' => 'file:./index.css', 'style' => 'file:./style-index.css', 'render' => 'file:./render.php', - 'viewScript' => 'file:./view.js' + 'viewScript' => 'file:./view.js', + 'attributes' => array( + 'mapHeight' => array( + 'type' => 'string', + 'default' => '' + ), + 'graphHeight' => array( + 'type' => 'string', + 'default' => '' + ), + 'showAttachments' => array( + 'type' => 'boolean', + 'default' => true + ), + 'showDownload' => array( + 'type' => 'boolean', + 'default' => true + ) + ) ) ); diff --git a/build/wp-attached-gpx/block.json b/build/wp-attached-gpx/block.json index d574fa9..b2baf1e 100644 --- a/build/wp-attached-gpx/block.json +++ b/build/wp-attached-gpx/block.json @@ -16,5 +16,23 @@ "editorStyle": "file:./index.css", "style": "file:./style-index.css", "render": "file:./render.php", - "viewScript": "file:./view.js" + "viewScript": "file:./view.js", + "attributes": { + "mapHeight": { + "type": "string", + "default": "" + }, + "graphHeight": { + "type": "string", + "default": "" + }, + "showAttachments": { + "type": "boolean", + "default": true + }, + "showDownload": { + "type": "boolean", + "default": true + } + } } \ No newline at end of file diff --git a/build/wp-attached-gpx/render.php b/build/wp-attached-gpx/render.php index fc60aaf..f4a10e5 100644 --- a/build/wp-attached-gpx/render.php +++ b/build/wp-attached-gpx/render.php @@ -8,7 +8,10 @@ $gpxes = get_attached_media('application/gpx+xml'); foreach ($gpxes as $id => $gpx) { $url = wp_get_attachment_url($id); - $parameters = ['gpx'=>$url, 'attachments'=>true]; + $parameters = array( 'gpx' => $url, 'attachments' => empty( $attributes['showAttachments'] ) ? 'false' : true ); + if ( ! empty( $attributes['mapHeight'] ) ) { $parameters['mheight'] = $attributes['mapHeight']; } + if ( ! empty( $attributes['graphHeight'] ) ) { $parameters['gheight'] = $attributes['graphHeight']; } + if ( empty( $attributes['showDownload'] ) ) { $parameters['download'] = 'false'; } echo '
'. wpgpxmaps_handle_shortcodes( diff --git a/src/wp-attached-gpx/block.json b/src/wp-attached-gpx/block.json index 87d53c9..51cded2 100644 --- a/src/wp-attached-gpx/block.json +++ b/src/wp-attached-gpx/block.json @@ -16,5 +16,11 @@ "editorStyle": "file:./index.css", "style": "file:./style-index.css", "render": "file:./render.php", - "viewScript": "file:./view.js" + "viewScript": "file:./view.js", + "attributes": { + "mapHeight": { "type": "string", "default": "" }, + "graphHeight": { "type": "string", "default": "" }, + "showAttachments": { "type": "boolean", "default": true }, + "showDownload": { "type": "boolean", "default": true } + } } diff --git a/src/wp-attached-gpx/render.php b/src/wp-attached-gpx/render.php index fc60aaf..f4a10e5 100644 --- a/src/wp-attached-gpx/render.php +++ b/src/wp-attached-gpx/render.php @@ -8,7 +8,10 @@ $gpxes = get_attached_media('application/gpx+xml'); foreach ($gpxes as $id => $gpx) { $url = wp_get_attachment_url($id); - $parameters = ['gpx'=>$url, 'attachments'=>true]; + $parameters = array( 'gpx' => $url, 'attachments' => empty( $attributes['showAttachments'] ) ? 'false' : true ); + if ( ! empty( $attributes['mapHeight'] ) ) { $parameters['mheight'] = $attributes['mapHeight']; } + if ( ! empty( $attributes['graphHeight'] ) ) { $parameters['gheight'] = $attributes['graphHeight']; } + if ( empty( $attributes['showDownload'] ) ) { $parameters['download'] = 'false'; } echo '
'. wpgpxmaps_handle_shortcodes(