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 '