PHPackages                             silvershop/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. [Admin Panels](/categories/admin)
4. /
5. silvershop/silverstripe-hasonefield

ActiveSilverstripe-vendormodule[Admin Panels](/categories/admin)

silvershop/silverstripe-hasonefield
===================================

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

5.0.0(10mo ago)34538.8k↓15.3%33[2 PRs](https://github.com/silvershop/silverstripe-hasonefield/pulls)20BSD-2-ClausePHPPHP ^8.3CI failing

Since Feb 21Pushed 3mo ago5 watchersCompare

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

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

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

66

—

FairBetter than 99% of packages

Maintenance70

Regular maintenance activity

Popularity51

Moderate usage in the ecosystem

Community41

Growing community involvement

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

306d 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/101629?v=4)[Will Rossiter](/maintainers/wilr)[@wilr](https://github.com/wilr)

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

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

---

Top Contributors

[![wilr](https://avatars.githubusercontent.com/u/101629?v=4)](https://github.com/wilr "wilr (43 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/silvershop-silverstripe-hasonefield/health.svg)

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

###  Alternatives

[silverstripe/admin

SilverStripe admin interface

262.6M325](/packages/silverstripe-admin)[colymba/gridfield-bulk-editing-tools

Silverstripe CMS GridField component to upload images/files and edit records in bulk

94677.2k39](/packages/colymba-gridfield-bulk-editing-tools)[silverstripe/lumberjack

A module to make managing pages in a GridField easy without losing any of the functionality that you're used to in the CMS.

331.1M33](/packages/silverstripe-lumberjack)[stevie-mayhew/hasoneedit

Allows editing the fields of a has\_one object directly in the CMS

21225.4k11](/packages/stevie-mayhew-hasoneedit)[plastyk/dashboard

An extendable dashboard for Silverstripe

2243.0k2](/packages/plastyk-dashboard)[silverstripe/superglue

102.2k](/packages/silverstripe-superglue)

PHPackages © 2026

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