From the course: Drupal 9 Essential Training: 3 Taxonomy, Media, and Modules

Scheduling content - Drupal Tutorial

From the course: Drupal 9 Essential Training: 3 Taxonomy, Media, and Modules

Start my 1-month free trial

Scheduling content

- [Instructor] In this video we're going to start exploring, installing different modules. Now, you remember from our modules explain video that you always need to make sure that your module works with the version of Drupal you're working with. So whenever you're searching here at Drupal.org, you want to make sure that you change that to Drupal 9. When you click search here as I mentioned, it'll always take you to the most popular modules for any given version of Drupal. Head over to drupal.org/project/scheduler. The scheduler module, gives content editors the ability to schedule nodes to be published and unpublished at specific dates and times in the future. Once again, we always double check that the module we're interested in works with Drupal 9. And this is the key right here where it says requires Drupal eight or above or nine and above and it's green, so it's ready to go. It's the recommended version by the projects maintainer. And if they're using the automated test, you'll see the results down here. As I mentioned in the introduction there are four ways to install a module in Drupal. In this video, we're going to stick with the standard approach. So hover over the zip or the tar, right-click and copy the link on the zip file and head back over to our site. Hover on extend and click install new module. And paste from a URL. Now again if this doesn't work for you, on a PC with Dev Desktop just go ahead and upload the file, click install. Go ahead and click enable newly added modules and you're going to scroll down. Down under other and you'll see scheduler and scheduler rules integration. Now the next question people ask is well, which ones do I install? Because some modules actually have five, six or seven entries here under the other or their own tab. Well, you need to read the documentation for that. In our example today, all we need is the scheduler module. So go ahead and put a check mark in there and click install. And there we are. Now, if I scroll back down under other and click on the down caret, there's a link to help, permissions and configure. And you'll note that this module requires system, date-time, field, node, text, filter, user and views modules to be enabled. And those are always enabled by default by the way. And it's required by the schedule rules integration which we're not going to use. Go ahead and click on configure. And this actually takes us to configuration, content authoring and scheduler. If you want users to only specify a date and the time is irrelevant, well, you can put a check mark in here. I find that most people want to put the date and time in so I usually leave that alone and on the lightweight cron tab. So cron in any website is, something that runs in the background at a given specific time period. And so cron needs to be set up if you're using your own web host for this, this is something you need to do. Head over to structure, content types and let's manage the article content type. So just click on the word article. And for every content type. Now you're going to see a new entry here called scheduler where we can enable publishing and unpublishing on any given content type. So let's do that for the article content type. We'll enable scheduling. You'll note that it says, change the content creation time to match the scheduled publishing time. You can do that. You can make it so it requires a scheduled publishing. We won't do that because we want to leave it with the ability to just be published if we click save. It can create a new revision on publishing. And if you click on advanced options, it's going to ask what do you want to do if the editor chooses a date in the past? You can display an error message, publish the content immediately after saving or schedule the content for publication on the next cron run. Let's go ahead and click enable unpublishing and it'll enable scheduled unpublishing for the content type. So now I can publish it on demand and unpublish it on demand. And finally, since we've enabled these options, we have options under the node edit page. Where do I want this information to be found? In the vertical tab which will be over here on the right-hand side or in a separate field set at the bottom of the node. I kind of like it over on the right-hand side. So we're going to leave that as it is. All right, save content type. So this is a particularly helpful module. I install it on a lot of Drupal sites that I use. Head over to content and let's edit our welcome to Drupalville node which is the article content type, click edit. And you'll now see a dropdown called scheduling options. By leaving it blank, it's going to be scheduled as soon as we hit publish. But now I can update it and give it a publication date. Now, again, I'm in Safari. If I was in Chrome, I would have a little calendar icon here. You'll see the format for your browser here. So by adding this module, we've added some tremendous functionality to our Drupal website. If I wanted to have the scheduling on all of my content types, well I would just go to each content type, click on the name of the content type and enable or disable scheduler as I want. Tremendous value from a contributed module.

Contents