1

We are currently migrating a Drupal 6 site to Drupal 8. We have a view that shows a table of files uploaded through the file depot. One of the columns on the table was an Expiration Date. In Drupal 6 we had a module called Auto Expire to set a date for a node to expire which we used to create a field on the view showing the number of days until the link to the file expired.

We created a Node view with multiple fields as the column headings (Date Created, Expiration Date, Staff Member, File Name). For the expiration field, we used Auto Expire to create an Expiration Date field set to 7 days after the creation date. After the 7 days, the node (file depot page) and it's attachments would get deleted.

How do I recreate this functionality (whether programmatically or otherwise) in Drupal 8, since Auto Expire is not updated for Drupal 8?

I am currently looking into the Scheduler module as there is a version for Drupal 8.

3
  • You can use rules to do this . An track your custom field expiration date – Malek Massoudi Jul 1 '16 at 21:48
  • Really? How???? – Pierre.Vriens Jul 1 '16 at 22:11
  • "How do I recreate Auto Expire" unfortunately is a too-broad question for Drupal Answers. Please try to get something up-and-running yourself and then ask a specific and narrow question if something's not working as expected. – leymannx Oct 29 '18 at 10:08
0

You can use Scheduler to unpublish the node (and then optionally use Scheduler's hooks/events to delete the node). However, to get the date set into the Scheduler unpublish_on field, you could use Rules (reacting on 'after creating' event) or use your own custom mymodule_hook_save() to set the date.

We are also in the process of migrating Scheduler's actions and events for Rules, (see https://www.drupal.org/node/2651348) and I think that Rules would then let you delete the node reacting to being unpublished by Scheduler.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.