I have created a media entity type named "audio" (using media_entity module) which have a entity reference field and an file field. Now I want to rename and move files attached to that entity in a directory which is created according to the title of referenced entity's content.
For example I have an media entity type "audio" which has a file field which accepts mp3 and an entity reference field which is referenced to a node type "test". I have created two "test" type content "hello_test" "hello_test_2". Now if I create a content of media entity type "audio" named "test audio" with referenced entity "hello_test" and a mp3 file named "abc.mp3" then while saving "test audio" the mp3 file should be renamed as "hello_test.mp3" and it should be stored into "hello_test/" directory.
I tried it using hook_entity_presave and hook_ENTITY_TYPE_presave but it did not work. Is there any way to rename and move file in this way before saving the entity.
and also please suggest if it is possible using drupal 8 rules.
Closed: works as designed
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.