You can try this in Field Calculator:
array_to_string( array_foreach( array_filter(array_remove_all(@layers, @layer), overlay_intersects(@element)), layer_property(@element,'name')),', ')
Explanation:
- Get a list of layers using
@layers
- Take out the current layer from that list using
array_remove_all(@layers,@layer)
- Filter that list with
array_filter()
using conditionoverlay_intersects()
to test if any feature on each layer intersects with your current layer. - Iterate through the resulting list with
array_foreach()
and extract the name for each layer withlayer_property()
. - Finally, convert the list (array) to text (string) using
array_to_string()
and your preferred delimiter.
Example (shown in label of polygon layer 'temp' - other layers include point layers but principle is the same):