In Drupal 8 I want only one node at a time to be promoted to front page. If user promoted new node the existed should un-promoted automatically.

Can we implement this with events in Drupal 8?


The settings for FrontPage is provided by default in Drupal 8. Because the Frontpage in Drupal 8 is a View, so it opens all kind of setting feasibility.

Hence if you go at Admin/structures/views you will find a view named FrontPage.

Hence, you just need to change the Pager setting. Change item 10 to item 1.

And in sort criteria It is already Content: Author on (desc), so it will automatically will show new item first. So as you publish new item it will replaced and you have set item 1 in pager, so only 1 item will be shown on front page which is latest one.

enter image description here

  • Thanks for answer but my question is how I achieve this programmatically (we have some complex multilingual logic on site). I was wondering may be it's possible with Drupal 8 events. One solution could be implement hook_presave or hook_update_node etc and check if promotion is selected remove old promoted node and buildView for front page with new promoted node. Thinking how do implement this with new DRUPAL 8 EVENTS if possible. Aug 4 '16 at 16:32
  • But my friend, you did not specify in your question regarding doing this programmatically..:) All answerer first takes a pure drupal UI approach. If not then they suggest whether code or module. Anyway, I also learned something from your question, so thanks. For programmatically, I will think and if found out I will add update in answer. I suggest you to add update in your question, about complexity and want to achieve programmatically, so others will get better idea.
    – CodeNext
    Aug 4 '16 at 16:42
  • The question was obviously asking for a programmatic solution. It says that the node should be unpromoted "automatically", which means that it isn't being done manually in the UI. It also asks how to implement the desired behavior using events, which are an inherently programmatic concept. Jul 15 at 14:04

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.