PHPackages                             toastnz/gridfieldrelationhandler - 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. toastnz/gridfieldrelationhandler

ActiveSilverstripe-module[Utility &amp; Helpers](/categories/utility)

toastnz/gridfieldrelationhandler
================================

This module provides two GridField components that aid in managing relationships within SilverStripe.

0217PHP

Since Oct 17Pushed 6y ago1 watchersCompare

[ Source](https://github.com/toastnz/silverstripe-GridFieldRelationHandler)[ Packagist](https://packagist.org/packages/toastnz/gridfieldrelationhandler)[ RSS](/packages/toastnz-gridfieldrelationhandler/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

GridFieldRelationHandler
------------------------

[](#gridfieldrelationhandler)

This module provides two [`GridField`](http://doc.silverstripe.org/framework/en/topics/grid-field) components that aid in managing relationships within [SilverStripe](http://www.silverstripe.org). The [`GridFieldHasOneRelationHandler`](#gridfieldhasonerelationhandler) component allows a `SS_List` to be used to select the value of a has\_one relation and the [`GridFieldManyRelationHandler`](#gridfieldmanyrelationhandler) component manages a `RelationList`.

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

[](#installation)

If the version of SilverStripe you are running is earlier than 3.0.3, first apply [this patch](https://github.com/silverstripe/sapphire/commit/d2b4e0df01f82fdbe613890c8ae909af404640a5) to `GridFieldPaginator`.

Download this module and extract it into your site's root folder. Flush your site's manifest by visiting . These components are now ready for use.

GridFieldHasOneRelationHandler
------------------------------

[](#gridfieldhasonerelationhandler)

[![](https://camo.githubusercontent.com/472e081a2580a9ec2ad3286fcd3777e0ab2df97205515e7adf1f535701741c5c/68747470733a2f2f66696c65732e6170702e6e65742f7a623973553576732e706e67)](https://camo.githubusercontent.com/472e081a2580a9ec2ad3286fcd3777e0ab2df97205515e7adf1f535701741c5c/68747470733a2f2f66696c65732e6170702e6e65742f7a623973553576732e706e67)

The `GridFieldHasOneRelationHandler` component provides radio buttons for selecting the object that the has\_one points to. Its constructor takes the object the relation exists on, the name of the relation and an optional target fragment which describes the position of the save relation button.

### Example

[](#example)

```
:::php
$config->addComponent(new GridFieldHasOneRelationHandler($this, 'MainImage'));

```

GridFieldManyRelationHandler
----------------------------

[](#gridfieldmanyrelationhandler)

[![](https://camo.githubusercontent.com/ce37188c916d2dc074e43b948b09509ee7356c9269aa752b05703b5476a75e79/68747470733a2f2f66696c65732e6170702e6e65742f7a623972375671452e706e67)](https://camo.githubusercontent.com/ce37188c916d2dc074e43b948b09509ee7356c9269aa752b05703b5476a75e79/68747470733a2f2f66696c65732e6170702e6e65742f7a623972375671452e706e67)

The `GridFieldManyRelationHandler` component provides check boxes for selecting the objects that a has\_many or many\_many point to. Its constructor takes an optional target fragment which describes the position of the save relation button.

If your `GridField` also has a `GridFieldPaginator` component, this component must be inserted before it for the pagination to work properly.

### Example

[](#example-1)

```
:::php
// The second argument here ensures that this component is placed before any GridFieldPaginator
$config->addComponent(new GridFieldManyRelationHandler(), 'GridFieldPaginator');

```

License
-------

[](#license)

```
Copyright (c) 2014, Simon Welsh - simon.geek.nz
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * The name of Simon Welsh may not be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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/df607b08f1e079b3bda7faf13d886ddbdb2b9f1e2e84fb646f953acbf787b152?d=identicon)[intotheweb101](/maintainers/intotheweb101)

---

Top Contributors

[![banglashi](https://avatars.githubusercontent.com/u/942981?v=4)](https://github.com/banglashi "banglashi (2 commits)")[![intotheweb101](https://avatars.githubusercontent.com/u/6877909?v=4)](https://github.com/intotheweb101 "intotheweb101 (2 commits)")[![simonwelsh](https://avatars.githubusercontent.com/u/125915?v=4)](https://github.com/simonwelsh "simonwelsh (2 commits)")[![bumbus](https://avatars.githubusercontent.com/u/1391103?v=4)](https://github.com/bumbus "bumbus (1 commits)")

### Embed Badge

![Health badge](/badges/toastnz-gridfieldrelationhandler/health.svg)

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

PHPackages © 2026

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