PHPackages                             delaneymethod/craft-category-groups - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. delaneymethod/craft-category-groups

ActiveCraft-plugin[Utility &amp; Helpers](/categories/utility)

delaneymethod/craft-category-groups
===================================

Two field types for Craft CMS that lets you select one or more Category Groups or one or more Categories from one or more Category Groups.

1.0.0(6mo ago)017MITPHPPHP ^8.0

Since Oct 30Pushed 6mo agoCompare

[ Source](https://github.com/delaneymethod/craft-category-groups)[ Packagist](https://packagist.org/packages/delaneymethod/craft-category-groups)[ RSS](/packages/delaneymethod-craft-category-groups/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Category Groups (Craft CMS)
===========================

[](#category-groups-craft-cms)

Two field types for Craft CMS that:

- lets you select one or more Category Groups.
- lets you select one or more Categories from one or more Category Groups.

Install
-------

[](#install)

1. Add the repo to your project and install via Composer:

```
cd /path/to/project

composer require delaneymethod/category-groups && php craft plugin/install category-groups
```

Usage
-----

[](#usage)

### `CategoryGroupField`

[](#categorygroupfield)

- In the dropdown/radio buttons mode your field normalizes to a `CategoryGroup|null`.
- In checkbox mode you return an `array`.

Print the selected group name(s):

```
{% set fieldValue = entry.myCategoryGroupsFieldHandle ?? null %}
{% if fieldValue %}
	{% if fieldValue is instance of('craft\\models\\CategoryGroup') %}
		Selected category group: {{ fieldValue.name }}
	{% elseif fieldValue is iterable %}
		Selected category groups:

			{% for categoryGroup in fieldValue %}
				{{ categoryGroup.name }}
			{% endfor %}

	{% elseif fieldValue is string %}
		{% set categoryGroup = craft.app.categories.getGroupByUid(fieldValue) %}
		{% if categoryGroup %}
			Selected category group: {{ categoryGroup.name }}
		{% endif %}
	{% else %}
		No category group selected.
	{% endif %}
{% else %}
	No category groups selected.
{% endif %}

```

Use the selected category group to list its categories (current site)

```
{% if fieldValue is instance of('craft\\models\\CategoryGroup') %}
	{% set categories = craft.categories().groupId(fieldValue.id).siteId(craft.app.sites.currentSite.id).status(null).orderBy('title asc').all() %}
	{% if categories %}
		Category group: {{ fieldValue.name }}

			{% for category in categories %}
				{{ category.title }}
			{% endfor %}

	{% else %}
		No categories found in {{ fieldValue.name }}.
	{% endif %}
{% elseif fieldValue is iterable %}
	{% for categoryGroup in fieldValue %}
		{% set categories = craft.categories().groupId(categoryGroup.id).siteId(craft.app.sites.currentSite.id).status(null).orderBy('title asc').all() %}
		{% if categories %}
			Category group: {{ categoryGroup.uid }}

				{% for category in categories %}
					{{ category.title }}
				{% endfor %}

		{% else %}
			No categories found in {{ categoryGroup.name }}.
		{% endif %}
	{% endfor %}
{% elseif fieldValue is string %}
	{% set categoryGroup = craft.app.categories.getGroupByUid(fieldValue) %}
	{% if categoryGroup %}
		{% set categories = craft.categories().groupId(categoryGroup.id).siteId(craft.app.sites.currentSite.id).status(null).orderBy('title asc').all() %}
		{% if categories %}
			Category group: {{ categoryGroup.name }}

				{% for category in categories %}
					{{ category.title }}
				{% endfor %}

		{% else %}
			No categories found for {{ categoryGroup.name }}.
		{% endif %}
	{% else %}
		No category group found for {{ fieldValue }}.
	{% endif %}
{% endif %}

```

### `CategoryGroupsField`

[](#categorygroupsfield)

- Normalizes to a `CategoryQuery`.
- You can iterate, count, limit, etc.

List selected categories (title + group)

```
{% set categoryQuery = entry.myCategoryMultipleGroupsFieldHandle ?? null %}
{% if categoryQuery %}
	{% set categories = categoryQuery.status(null).all() %}
	{% if categories %}

			{% for category in categories %}
				{{ category.title }} ({{ category.group.name }})
			{% endfor %}

	{% else %}
		No categories selected.
	{% endif %}
{% else %}
	No categories selected.
{% endif %}

```

Count / limit / paginate

```
{% set categoryQuery = entry.myCategoryMultipleGroupsFieldHandle ?? null %}
{% if categoryQuery %}
	{% set count = categoryQuery.count() }}
	{% if count > 1 %}
		{{ count }} categories selected.
	{% else %}
		1 category selected.
	{% endif %}

	{% set firstFiveCategories = categoryQuery.status(null).limit(5).all() %}
	{% if firstFiveCategories %}
		First five categories:

			{% for category in firstFiveCategories %}
				{{ category.title }}
			{% endfor %}

	{% endif %}
{% endif %}

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance66

Regular maintenance activity

Popularity8

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

200d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cfb4e92a4d0600764dcbc0058a37dc46627428e876e3bf806e398a5f1ad1f283?d=identicon)[hello@delaneymethod.com](/maintainers/hello@delaneymethod.com)

---

Tags

cmsgroupsmulticategoriesCraftcraftcmscraft-plugincategorycategory groupsmulti groupsmulti category groups

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/delaneymethod-craft-category-groups/health.svg)

```
[![Health](https://phpackages.com/badges/delaneymethod-craft-category-groups/health.svg)](https://phpackages.com/packages/delaneymethod-craft-category-groups)
```

###  Alternatives

[verbb/navigation

Create navigation menus for your site.

90683.7k17](/packages/verbb-navigation)[verbb/formie

The most user-friendly forms plugin for Craft.

101372.9k40](/packages/verbb-formie)[verbb/comments

Add comments to your site.

13753.1k](/packages/verbb-comments)[verbb/tablemaker

Create customizable and user-defined table fields.

40168.8k1](/packages/verbb-tablemaker)[supercool/tablemaker

Create customizable and user-defined table fields.

40141.7k](/packages/supercool-tablemaker)[verbb/vizy

A flexible visual editor field for Craft.

4348.6k](/packages/verbb-vizy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
