Skip to content

Commit ff2ee92

Browse files
authored
Merge pull request #722 from ExpressionEngine/feature/7.x/category-group-settings
Allow making category group required for channel; Allow restricting category selection to single category per group
2 parents 9b6dabc + f1c46d7 commit ff2ee92

File tree

8 files changed

+103
-6
lines changed

8 files changed

+103
-6
lines changed
29.8 KB
Loading
30.4 KB
Loading

docs/control-panel/channels.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ A channel can have any combination of fields and field groups assigned to it. Yo
6161

6262
This tab allows you to create and assign category groups to your channel. A channel may have multiple category groups assigned, and groups can be created on the fly on this tab.
6363

64+
![Channel Preferences - Categories settings](_images/cp-channel-categories-tab.png)
65+
66+
For each category group assigned to a channel, the following per-group settings are available:
67+
68+
| Setting | Default | Description |
69+
| --------------- | ------- | ------------------------------------------------------------------------------------------- |
70+
| Allow multiple? | Yes | When turned on, multiple categories from the group can be selected for an entry |
71+
| Required? | No | When turned on, selecting at least one category from the group is required to save an entry |
72+
6473
---
6574

6675
### Statuses tab

docs/control-panel/create.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,13 @@ You may _optionally_ specify a date on which comments for this entry will no lon
6868

6969
## Categories Tab
7070

71-
You may assign your entries to one ore more categories. To select more than one category you will typically hold down the CTRL (or CMD) key while choosing the individual category names.
71+
You may assign one or multiple (depending on [channel preference](control-panel/channels.md#categories-tab)) categories to your entry from the [category groups](control-panel/categories.md) associated with the channel.
7272

73-
Clicking the Edit Categories link will permit you to add, edit, or delete categories that appear in the list.
73+
Each associated category group will be rendered as a separate set of checkboxes. If multiple selections are not allowed they will render as a set of radio buttons. Selecting a category from a group can also be set as required for the channel.
74+
75+
Additionally, a "Manage Categories" toggle is provided which allows the user to add, edit or reorder categories within the group.
76+
77+
![Publish Form - Categories](_images/cp-entry-categories-tab.png)
7478

7579
## Options Tab
7680

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
lang: php
3+
---
4+
5+
<!--
6+
This source file is part of the open source project
7+
ExpressionEngine User Guide (https://github.com/ExpressionEngine/ExpressionEngine-User-Guide)
8+
9+
@link https://expressionengine.com/
10+
@copyright Copyright (c) 2003-2023, Packet Tide, LLC (https://packettide.com)
11+
@license https://expressionengine.com/license Licensed under Apache License, Version 2.0
12+
-->
13+
14+
# Category Group Settings Model
15+
16+
**class `ExpressionEngine\Model\CategoryGroupSettings`**
17+
18+
[TOC]
19+
20+
## Properties
21+
22+
| Name | Validation | Type | Description |
23+
| ---------------------------- |------------- | ---------- | ----------- |
24+
| `category_group_settings_id` | | | the primary key |
25+
| `site_id` | | | the site id |
26+
| `group_id` | required | | the category group id |
27+
| `channel_id` | required | | the channel id |
28+
| `cat_required` | | boolString | whether or not having a category in this group is required for this channel |
29+
| `cat_allow_multiple` | | boolString | whether or not having multiple selections is allowed in this category group for this channel |
30+
31+
## Relationships
32+
33+
### `Site`
34+
35+
The MSM Site for which the Category Group belongs to.
36+
37+
### `Channel`
38+
39+
Channel for which these settings are defined
40+
41+
### `CategoryGroup`
42+
43+
Category Group for which these settings are defined
44+
45+
46+
## Methods
47+
48+
- `getAllCustomFields()`
49+
- `createCategoryField()`
50+
- `getContentType()`
51+
- `getCategoryTree()`
52+
- `getFieldMetadata()`
53+
- `populateCategories()`
54+
- `buildCategoryOptionsTree()`
55+
- `buildCategoryList($categories, $sort_column)`
56+
57+
## Events
58+
59+
- `afterDelete`

docs/development/models/category-group.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ lang: php
77
ExpressionEngine User Guide (https://github.com/ExpressionEngine/ExpressionEngine-User-Guide)
88
99
@link https://expressionengine.com/
10-
@copyright Copyright (c) 2003-2022, Packet Tide, LLC (https://packettide.com)
10+
@copyright Copyright (c) 2003-2023, Packet Tide, LLC (https://packettide.com)
1111
@license https://expressionengine.com/license Licensed under Apache License, Version 2.0
1212
-->
1313

@@ -32,8 +32,29 @@ lang: php
3232

3333
## Relationships
3434

35-
- `CategoryField`
36-
- `Category`
35+
### `Site`
36+
37+
The MSM Site which the Category Group belongs to.
38+
39+
### `CategoryGroupSettings`
40+
41+
Per-channel settings for this Category Group.
42+
43+
### `CategoryFields`
44+
45+
Custom fields associated with this Category Group
46+
47+
### `Categories`
48+
49+
Collection of categories that have been created in this group
50+
51+
### `Channels`
52+
53+
Channels that this Category Group has been assigned to
54+
55+
### `UploadDestinations`
56+
57+
File upload directories that this Category Group has been assigned to
3758

3859
## Methods
3960

docs/development/models/working-with-models.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ These are the most commonly used models in ExpressionEngine. For a full list, se
2626
- [Addon Fieldtype Model](development/models/addon-fieldtype.md)
2727
- [Addon Module Model](development/models/addon-module.md)
2828
- [Addon Plugin Model](development/models/addon-plugin.md)
29-
- [Category Field](development/models/category-field.md)
3029
- [Category Group](development/models/category-group.md)
30+
- [Category Group Settings](development/models/category-group-settings.md)
31+
- [Category](development/models/category.md)
32+
- [Category Field](development/models/category-field.md)
3133
- [Channel Entry Model](development/models/channel-entry.md)
3234
- [Channel Field Group Model](development/models/channel-field-group.md)
3335
- [Channel Field Model](development/models/channel-field.md)

docs/toc_sections/_advanced_usage_toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,8 @@
420420
href: development/models/category-field.md
421421
- name: Category Group Model
422422
href: development/models/category-group.md
423+
- name: Category Group Settings Model
424+
href: development/models/category-group-settings.md
423425
- name: Channel Entry Model
424426
href: development/models/channel-entry.md
425427
- name: Channel Field Group Model

0 commit comments

Comments
 (0)