PHPackages                             burnbright/silverstripe-hasonefield - 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. burnbright/silverstripe-hasonefield

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

burnbright/silverstripe-hasonefield
===================================

Edit a has\_one relationship using a GridField, triggered by clicking a button.

5.0.0(11mo ago)3440.3k33[2 issues](https://github.com/silvershop/silverstripe-hasonefield/issues)[2 PRs](https://github.com/silvershop/silverstripe-hasonefield/pulls)1BSD-2-ClausePHPPHP ^8.3CI failing

Since Feb 21Pushed 1mo ago5 watchersCompare

[ Source](https://github.com/silvershop/silverstripe-hasonefield)[ Packagist](https://packagist.org/packages/burnbright/silverstripe-hasonefield)[ RSS](/packages/burnbright-silverstripe-hasonefield/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (3)Versions (29)Used By (1)

SilverStripe has\_one field
===========================

[](#silverstripe-has_one-field)

[![Build Status](https://camo.githubusercontent.com/f93063d7b6e958ecca0b718d3f77ec39893fce804b590f65f22c7c2b981dbb86/68747470733a2f2f7472617669732d63692e6f72672f73696c76657273686f702f73696c7665727374726970652d6861736f6e656669656c642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/silvershop/silverstripe-hasonefield)[![Latest Stable Version](https://camo.githubusercontent.com/dd49a89aa46bc3b51a9328f871d024d279f534d98cff2d8697f7dfb3cc114451/68747470733a2f2f706f7365722e707567782e6f72672f73696c76657273686f702f73696c7665727374726970652d6861736f6e656669656c642f762f737461626c65)](https://packagist.org/packages/silvershop/silverstripe-hasonefield)[![Latest Unstable Version](https://camo.githubusercontent.com/fa41150608f1dfe8cc19444b48870c0690194d575d099dc2785b6887104a3276/68747470733a2f2f706f7365722e707567782e6f72672f73696c76657273686f702f73696c7665727374726970652d6861736f6e656669656c642f762f756e737461626c65)](https://packagist.org/packages/silvershop/silverstripe-hasonefield)

Allows you to create a CMS button for creating and editing a single related object. It is actually a grid field, but just looks like a button.

[![demo](https://camo.githubusercontent.com/88e3caf65d933157d62a06832a5d05ac666d4a89a23863038953cb8340f97e34/68747470733a2f2f7261772e6769746875622e636f6d2f77696b692f73696c76657273686f702f73696c7665727374726970652d6861736f6e656669656c642f696d616765732f6861736f6e656669656c642e676966)](https://camo.githubusercontent.com/88e3caf65d933157d62a06832a5d05ac666d4a89a23863038953cb8340f97e34/68747470733a2f2f7261772e6769746875622e636f6d2f77696b692f73696c76657273686f702f73696c7665727374726970652d6861736f6e656669656c642f696d616765732f6861736f6e656669656c642e676966)

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

[](#installation)

```
composer require silvershop/silverstripe-hasonefield

```

Usage
-----

[](#usage)

```
    use SilverShop\HasOneField\HasOneButtonField;

    private static $has_one = [
        'Address' => 'Address'
    ];

    public function getCMSFields() {
        $fields = parent::getCMSFields();

        $fields->addFieldToTab("Root.Main",
            HasOneButtonField::create($this, "Address")
        );

        return $fields;
    }
```

You must pass through the parent context ($this), so that the `has_one`relationship can be set by the `GridFieldDetailForm`.

Filtering Results
-----------------

[](#filtering-results)

To filter the results shown in the picker use `HasOneAddExistingAutoCompleter::setSearchList`.

```
$property = HasOneButtonField::create(
    $this,
    'Address'
);

$property
    ->getConfig()
    ->getComponentByType(HasOneAddExistingAutoCompleter::class)
    ->setSearchList(Property::get()->filter("Country", "GB"));

$fields->addFieldToTab(
    'Root.Main',
    $property
);
```

###  Health Score

61

—

FairBetter than 98% of packages

Maintenance71

Regular maintenance activity

Popularity40

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity89

Battle-tested with a long release history

 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.

###  Release Activity

Cadence

Every ~180 days

Recently: every ~286 days

Total

20

Last Release

354d ago

Major Versions

1.0.0 → 2.0-alpha12018-01-28

1.x-dev → 2.x-dev2018-02-05

2.1.1 → 3.0.02018-11-07

3.1.0 → 4.0.02023-07-12

4.1.0 → 5.0.02025-07-16

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1356335?v=4)[Jeremy Shipman](/maintainers/jedateach)[@jedateach](https://github.com/jedateach)

---

Top Contributors

[![wilr](https://avatars.githubusercontent.com/u/101629?v=4)](https://github.com/wilr "wilr (44 commits)")[![hchokshi](https://avatars.githubusercontent.com/u/10136407?v=4)](https://github.com/hchokshi "hchokshi (23 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (12 commits)")[![jedateach](https://avatars.githubusercontent.com/u/1356335?v=4)](https://github.com/jedateach "jedateach (8 commits)")[![mlewis-everley](https://avatars.githubusercontent.com/u/687143?v=4)](https://github.com/mlewis-everley "mlewis-everley (6 commits)")[![jaydenseric](https://avatars.githubusercontent.com/u/1754873?v=4)](https://github.com/jaydenseric "jaydenseric (4 commits)")[![bummzack](https://avatars.githubusercontent.com/u/1006185?v=4)](https://github.com/bummzack "bummzack (4 commits)")[![NikxDa](https://avatars.githubusercontent.com/u/3141005?v=4)](https://github.com/NikxDa "NikxDa (3 commits)")[![mooror](https://avatars.githubusercontent.com/u/6110819?v=4)](https://github.com/mooror "mooror (2 commits)")[![thepearson](https://avatars.githubusercontent.com/u/1651296?v=4)](https://github.com/thepearson "thepearson (2 commits)")[![oilee80](https://avatars.githubusercontent.com/u/1453382?v=4)](https://github.com/oilee80 "oilee80 (2 commits)")[![jsirish](https://avatars.githubusercontent.com/u/1163643?v=4)](https://github.com/jsirish "jsirish (2 commits)")[![MasonD](https://avatars.githubusercontent.com/u/612454?v=4)](https://github.com/MasonD "MasonD (1 commits)")[![dmcb](https://avatars.githubusercontent.com/u/1037133?v=4)](https://github.com/dmcb "dmcb (1 commits)")[![dpezer](https://avatars.githubusercontent.com/u/1654953?v=4)](https://github.com/dpezer "dpezer (1 commits)")[![Leapfrognz](https://avatars.githubusercontent.com/u/1740262?v=4)](https://github.com/Leapfrognz "Leapfrognz (1 commits)")[![lekoala](https://avatars.githubusercontent.com/u/250762?v=4)](https://github.com/lekoala "lekoala (1 commits)")[![adrexia](https://avatars.githubusercontent.com/u/984753?v=4)](https://github.com/adrexia "adrexia (1 commits)")[![mfendeksilverstripe](https://avatars.githubusercontent.com/u/26395487?v=4)](https://github.com/mfendeksilverstripe "mfendeksilverstripe (1 commits)")[![robbieaverill](https://avatars.githubusercontent.com/u/5170590?v=4)](https://github.com/robbieaverill "robbieaverill (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/burnbright-silverstripe-hasonefield/health.svg)

```
[![Health](https://phpackages.com/badges/burnbright-silverstripe-hasonefield/health.svg)](https://phpackages.com/packages/burnbright-silverstripe-hasonefield)
```

###  Alternatives

[silverstripe/userforms

UserForms enables CMS users to create dynamic forms via a drag and drop interface and without getting involved in any PHP code

1371.1M85](/packages/silverstripe-userforms)[lekoala/silverstripe-cms-actions

Add actions to your models in SilverStripe

39344.8k32](/packages/lekoala-silverstripe-cms-actions)[symbiote/silverstripe-advancedworkflow

Adds configurable workflow support to the CMS, with a GUI for creating custom workflow definitions.

46302.4k9](/packages/symbiote-silverstripe-advancedworkflow)[lekoala/silverstripe-softdelete

Soft delete extension for SilverStripe

11236.3k](/packages/lekoala-silverstripe-softdelete)

PHPackages © 2026

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