Drupal 10 - ECA to Set Media Name automatically when Node update

By BXTra |

I tried to use Media in my new project.  Any files to upload comes directly from scanner with default filename format contain only scanned date. To upload such file, there is nothing meaningful for user to search for to reuse it.  I tried to look for the way to set Media name automatically but I couldn't find it.  Therefore, I turned to ECA which I think this should work for this task.

With ECA, I use Views to get a list of Media used in such node.  Then, loop over the list and set Media name to include, node created date + node title + media created date.  That way, I can use Views to search for Media name and reused it.

Below is my set up : 

Drupal 10 - ECA to Set Media Name automatically when Node updateDrupal 10 - ECA to Set Media Name automatically when Node updateDrupal 10 - ECA to Set Media Name automatically when Node update

 

 

Drupal 10 - ECA to Set Media Name automatically when Node updateDrupal 10 - ECA to Set Media Name automatically when Node update

Once, I set it up, whenever I update the node, All Media files in such node will be renamed to what I set. When use it together with Entity Browser in View widget, I can use exposed Media name filter to search for Media needed to reuse.

Add new comment

  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.