PHPackages                             fostercommerce/entry-type-rules - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. fostercommerce/entry-type-rules

ActiveCraft-plugin[Validation &amp; Sanitization](/categories/validation)

fostercommerce/entry-type-rules
===============================

A Craft plugin that allows you to set rules on number of entry types in a Craft section and/or limit who can include entry type entries based on their user group.

3.0.1(1y ago)41.1k1[2 issues](https://github.com/FosterCommerce/entry-type-rules/issues)[1 PRs](https://github.com/FosterCommerce/entry-type-rules/pulls)proprietaryPHPPHP ^8.2CI passing

Since Feb 26Pushed 3mo agoCompare

[ Source](https://github.com/FosterCommerce/entry-type-rules)[ Packagist](https://packagist.org/packages/fostercommerce/entry-type-rules)[ RSS](/packages/fostercommerce-entry-type-rules/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (5)Dependencies (8)Versions (11)Used By (0)

[![Screenshot](resources/img/entry-type-rules-header.png)](resources/img/entry-type-rules-header.png)

Entry Type Rules plugin for Craft CMS 5
=======================================

[](#entry-type-rules-plugin-for-craft-cms-5)

A Craft plugin that allows you to set rules on number of entry types in a Craft section and/or limit who can include entry type entries based on their user group.

Requirements
------------

[](#requirements)

This plugin requires Craft CMS 5.0 or later.

Installation
------------

[](#installation)

To install the plugin, follow these instructions.

1. Open your terminal and go to your Craft project:

    ```
     cd /path/to/project

    ```
2. Then tell Composer to load the plugin:

    ```
     composer require fostercommerce/entry-type-rules

    ```
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Entry Type Rules.

Entry Type Rules Overview
-------------------------

[](#entry-type-rules-overview)

Entry Type Rules will allow you to restrict entry types in sections based on a count limit and/or user group. This can be useful when taking advantage of entry types for example in a structure section, where you could have a "Contact" entry type that you only want one of within a "Pages" structure section, or a "Blog Landing Page" entry type you would only like to allow certain users to be able to create.

[![Screenshot](resources/img/plugin-overview.png)](resources/img/plugin-overview.png)

For example, if an entry type in a section has a count limit set, and the number of entries for that entry type has been reached, when creating a new entry, the Entry Type selector field will have that entry type disabled. Likewise, if an entry type has been restricted to allow for only certain user groups to create new ones, and the current user is not in those user groups, the entry type option will also be disabled for that entry type.

Configuring Entry Type Rules
----------------------------

[](#configuring-entry-type-rules)

Entry Type Rules can be configured from its Settings page in the control panel or, by using a config file which will override the plugins settings from those set in the control panel settings page.

### Configure in the Control Panel Settings Page

[](#configure-in-the-control-panel-settings-page)

In the Control Panel, go to Settings → Entry Type Rules. The control panel settings page lists out all of your structure and channel sections, and their entry types. For each entry type you can place a numerical limit on the number of entries, and/or select the users groups which can create new entries of the entry type.

[![Screenshot](resources/img/plugin-settings.png)](resources/img/plugin-settings.png)

#### Limit Fields

[](#limit-fields)

The limit field allows you to set an entry limit for the entry type. Once the number of entries has reached that limit, the entry types option will be disabled in the entry edit form. If you set the limit to a number below the current number of entries of that entry type, a warning will be displayed. *NOTE: The setting will still be saved regardless of the warning, its just there to inform you.*

[![Screenshot](resources/img/plugin-warning.png)](resources/img/plugin-warning.png)

#### User Groups Fields

[](#user-groups-fields)

The user groups field allows you to select the user groups that can create new entries of the entry type. If a user is not in any of the specified groups, the entry types option will be disabled in the entry edit form. *NOTE: Admin users are never restricted from adding entries*

### Configure using a Config File

[](#configure-using-a-config-file)

To configure the plugin via a config file:

1. Copy the `config.php` file from the `vendor/fostercommerce/entry-type-rules` directory to Craft's `config/` directory
2. Rename it to `entry-type-rules.php`
3. Edit the `sections` array in that file to set the sections, entry types, limits, and user groups settings.

```
