PHPackages                             ournameismud/sortelements - 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. ournameismud/sortelements

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

ournameismud/sortelements
=========================

Field to sort related elements

11211PHP

Since Mar 27Pushed 3y ago2 watchersCompare

[ Source](https://github.com/ournameismud/sortelements)[ Packagist](https://packagist.org/packages/ournameismud/sortelements)[ RSS](/packages/ournameismud-sortelements/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Sort Elements plugin for Craft CMS 3.x &amp; 4.x
================================================

[](#sort-elements-plugin-for-craft-cms-3x--4x)

Field to sort related elements that have already been defined.

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

[](#requirements)

This plugin requires Craft CMS 3.0.0-beta.23 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 ournameismud/sortelements

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

Sort Elements Overview
----------------------

[](#sort-elements-overview)

Sort Elements creates a custom field for defining a custom order for elements that have already got a relationship established.

Configuring Sort Elements
-------------------------

[](#configuring-sort-elements)

Configuration is done in the field type where you are limited to specifying the element type that this field will be used to sort.

Using Sort Elements
-------------------

[](#using-sort-elements)

Sort Elements creates a custom field for defining a custom order for elements that have already got a relationship established.

For example Pro Boilers™ wants to categorise their products set up in a Products channel. You set up the product categories and assign them to the individual product entries but having done this they also want to sort the order that certain products are shown in.

We don't want to set up this relationship twice which is where the plugin comes in. We create a field type for our category that lets us sort the elements that are already related to it (from either entries, categories, assets, tags or users). Once we add our field, when editing the category we can then sort these and the field will output an array for use in our front-end templates.

[![Screenshot](resources/img/screenshot.png)](resources/img/screenshot.png)

To use in twig the field will simply output an array of ids. So with the above example we can fetch and sort our products like so:

```
{% set ids = category.boilerProducts %}

{% set entries = craft.entries({ id: ids, fixedOrder: true }) %}

```

The `fixedOrder` property is needed to respect the order of the ids in the array. By default (eg if the sort order has not been saved for a particular category) the field will return `null`. In this instance the entries query (or whatever element the field is tied to) will be returned based on any other properties defined (eg the `section` or if you want to set a relationship, eg `{ relatedTo: category }`).

Sort Elements Roadmap
---------------------

[](#sort-elements-roadmap)

Some things to do, and ideas for potential features:

- Look into updating with element save, eg if entry related to category field in category updated.

Brought to you by [@cole007](http://ournameismud.co.uk/)Icon created by ProSymbols from the Noun Project

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 Bus Factor1

Top contributor holds 70% of commits — single point of failure

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/bfde66cda0dee63eb0f7b9d546aac9da055d22b432871e5c620c01e48a2beca2?d=identicon)[ournameismud](/maintainers/ournameismud)

---

Top Contributors

[![laneigemud1990](https://avatars.githubusercontent.com/u/104374970?v=4)](https://github.com/laneigemud1990 "laneigemud1990 (7 commits)")[![cole007](https://avatars.githubusercontent.com/u/855195?v=4)](https://github.com/cole007 "cole007 (3 commits)")

### Embed Badge

![Health badge](/badges/ournameismud-sortelements/health.svg)

```
[![Health](https://phpackages.com/badges/ournameismud-sortelements/health.svg)](https://phpackages.com/packages/ournameismud-sortelements)
```

###  Alternatives

[workerman/globaldata

7767.6k18](/packages/workerman-globaldata)[uspdev/replicado

Classes PHP que consome dados do Replicado USP

136.6k8](/packages/uspdev-replicado)

PHPackages © 2026

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