Adaptation to work with wp-otherguise

This commit is contained in:
Eric van der Vlist 2026-10-10 22:02:17 +02:00
parent 63cbe3b54d
commit e6d0bbe2a1
5 changed files with 53 additions and 5 deletions

View File

@ -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
)
)
)
);

View File

@ -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
}
}
}

View File

@ -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 '<div class="attached-gpx">'.
wpgpxmaps_handle_shortcodes(

View File

@ -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 }
}
}

View File

@ -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 '<div class="attached-gpx">'.
wpgpxmaps_handle_shortcodes(