dotcomUNDERGROUND But is there any parameter available that will pass full path including domain? Like the copy link?
Domain and full url is not stored in the item
properties, because we don't need to store it for each specific item, and we don't use it for internal logic (we use relative paths). For copy link, it's calculated from within the actual function, and you would have to do the same for your href: (item) => {...}
function using Javascript location properties. We don't use absolute paths in Files gallery, unless strictly required (like the copy function).
dotcomUNDERGROUND And can I get separate values for directory and file? Like to make something.php?dir=folder/sub-folder&file=photo.jpg
Did you check the object properties? There are properties like filetype
and is_dir
which can be used inside the function and return the link accordingly.
dotcomUNDERGROUND Can I do similar custom context menu at directory level? Like to pass a value like something.php?dir=folder/subfolder
This is same as above. You can detect the type of item, and return url depending on the properties of the clicked item.
dotcomUNDERGROUND To take it a step further, it my PHP sharing/url shortening script can return a text link, can a function like copy link copy that returned value by PHP script to clipboard?
No, that doesn't work. You are returning a link that is opened in browser by the visitor ... You can't "return" the respond of the website being loaded into Files gallery.
To achieve something like that, it's more complicated of course. You want to create a "copy link" function that copies the response of your PHP script, that must load somehow in the background. To achieve this, you could create a function in the contextmenu, load your PHP in the background with Ajax, catch the response, and then copy in the visitors pasteboard.