I have a content type called "tile" that I'd like for there to only be 6 of published at any given point, so that the page they're on doesn't get too cluttered.

Is there a way to enact this restriction in a way that won't confuse the user?

Edit/For Clarification: It's alright if there are more pieces of content that exist that are unpublished, but I'd like for only 6 of them to be published at any given time.

  • Is the page they're on powered by a View? If so I'd be tempted to install the Entityqueue module, create a queue for the page, add it as a sort to the View, and have the users manage it from there. As a bonus they can now control the sort order specifically if they want to
    – Clive
    Jul 13, 2017 at 17:59
  • If you'd change the "6" in your question to "1", you could possibly use the Only One module, either for D7 or for D8. Maybe suggest a (minor?) feature request to make the "1" an admin parameter (so that you could set that to "6")? Talk to this user (= the maintainer) for more details ... Jul 13, 2017 at 18:51
  • 1
    you need to have only 6 published contents or 6 published contents and others n contents not published? I think that you need to explain a littler bit your question. Jul 13, 2017 at 20:52
  • Well after your edit I need to says you that you need to create a custom module to do this. This is for Drupal 8 or 7? Jul 14, 2017 at 3:23

2 Answers 2


The easiest way I can think of is pulling those tiles in as a view - limit it to the 6 most recently submitted tiles, and add a notice within the /node/add form to inform the user that creating a new tile will replace the oldest tile.

You could also add an extra field as a "Tile Display" - either a boolean (so an editor could go through and select the 6 they want to appear), or a number (set up a single-value number field, max value = 5, all must be unique. That way the user can go in and add a new tile, and if they want it to display first, they'd set the field to '0'; if '0' already exists, there will be a warning, and they'll have to go to the current 0-index tile to remove the value).

Your other option is to find some way to process the forms so that publishing a new tile forces the user to choose an old tile to un-publish - but that would be difficult to set up, and most likely confusing (at least for most content editors I've interacted with).


If this is a View, just limit the view and provide conditions (limit 6, must be published, sorted by new, etc).

The only enforced way I know to do this is with a Rule, or perhaps some other method of intercepting node/add/* route, counting the existing entities, and blocking access with "you have created the maximum" sort of message. IMO this really sucks for the end user, and is better managed through Views conditions.

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