Download the PHP package fostercommerce/entry-type-rules without Composer
On this page you can find all versions of the php package fostercommerce/entry-type-rules. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fostercommerce/entry-type-rules
More information about fostercommerce/entry-type-rules
Files in fostercommerce/entry-type-rules
Package entry-type-rules
Short Description 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.
License proprietary
Informations about the package entry-type-rules
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
This plugin requires Craft CMS 5.0 or later.
Installation
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project
-
Then tell Composer to load the plugin:
composer require fostercommerce/entry-type-rules
- In the Control Panel, go to Settings → Plugins and click the “Install” button for Entry Type Rules.
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.
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
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
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.
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.
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
To configure the plugin via a config file:
- Copy the
config.php
file from thevendor/fostercommerce/entry-type-rules
directory to Craft'sconfig/
directory - Rename it to
entry-type-rules.php
-
Edit the
sections
array in that file to set the sections, entry types, limits, and user groups settings. - In the
sections
array you include the section handles for each section. - Within those sections you include the entry type handles for each entry type you want to create rules for.
- Within the entry types you can then include rules for :
limit
- A numeric limit for the number of entries of that entry typeuserGroups
- An array of user group handles to limit who can create new entries of that entry type
Entry Type Rules Roadmap
The following is a list of additional features we are working on to incorporate into Entry Type Rules:
- Compatibility with Craft 4
- Include rules for entry types in structure sections based on parent entries entry type
- Include rules for entry types in sections based on different sites/languages in a Craft multi-site setup
- Provide front end methods and variables to implement entry type rules when new entries are submitted via Craft Entry Forms
- Extend native Craft user group permissions to include entry type permissions
Credits
Brought to you by Foster Commerce