PHPackages                             fromholdio/silverstripe-hasoneedit - 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. fromholdio/silverstripe-hasoneedit

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

fromholdio/silverstripe-hasoneedit
==================================

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

3.0.3(6mo ago)0511↑50%2WTFPLPHP

Since Aug 3Pushed 6mo agoCompare

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

READMEChangelog (4)Dependencies (1)Versions (16)Used By (2)

Has One Edit
============

[](#has-one-edit)

This is a fork from [stevie-mayhew/hasonedit](https://github.com/stevie-mayhew/hasonedit).

This module allows you to directly edit the fields of a related `has_one` object directly, without having to mess around with `GridField` or links to `ModelAdmin`. If the related `has_one` doesn't exist yet, then this module also creates the object and sets up the relation for you on first write.

This module has been tested editing a `has_one` in both a `GridFieldDetailForm` and on a generic `Page` in `CMSMain`.

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

[](#requirements)

SilverStripe 4.x, 5.x, 6.x.

Basic testing has been carried out on 4.0.x-dev. Extensive testing may be required as SS4 becomes more solid.

Usage
-----

[](#usage)

To use this module, simply add a field to the CMS fields for your object in your `getCMSFields()` method. The name of the field should be `HasOneName-_1_-FieldName`.

For example, say you have a `has_one` called `Show` and that `has_one` has a field called `Title` you want to edit. You'd add the field `TextField::create('Show-_1_-Title', 'Show Title')`.

If you do not require that the outputted name of the field matches the value you supply, you can also use a colon as a separator instead of `-_1_-`.

### Generating fields with the `ProvidesHasOneInlineFields` trait

[](#generating-fields-with-the-provideshasoneinlinefields-trait)

If you simply want to display all the CMS fields for a related object, you can add the `ProvidesHasOneInlineFields` trait to the object. This adds a method which calls `getCMSFields()`on your `DataObject` and return the `FormField`s for that object. Those `FormField`s will be converted for use with this module by adding the relation name and separator to their name.

In the owning object, where you want to display the fields, call `HasOneEdit::getInlineFields($this, 'my_has_one_name', ['db'])`. This will return the `db` subset of fields for adding to the CMS - e.g. you can display the related object's fields in their own tab by calling `$fields->addFieldsToTab('Root.RelatedObject', HasOneEdit::getInlineFields($this, 'Relation', ['db']))`.

This has the advantage of running the entire `getCMSFields()` call tree (e.g. `updateCMSFields` for any functionality provided via extension) etc. without having to repeat logic in a lot of places.

You can also implement a method `public function provideHasOneInlineFields($relationName)` returning `FieldList|FormField[]` to provide a custom interface different to `getCMSFields()` (e.g. just a small subset of fields). In this case, all the field names should be in the form `$relationName . HasOneEdit::FIELD_SEPARATOR . $dataObjectFieldName`. This method will be called by `HasOneEdit::getInlineFields` even if your class does not use the `ProvidesHasOneInlineFields` trait.

### Using with your own form

[](#using-with-your-own-form)

To add support to your own forms, you need to add the `Fromholdio\HasOneEdit\UpdateFormExtension` extension to your controller and call `$this->extend('updateEditForm', $form)` before returning the form to the template. Without this, the fields will not get populated with the values from the `has_one` though saving will work.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance69

Regular maintenance activity

Popularity18

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity71

Established project with proven stability

 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 ~268 days

Recently: every ~161 days

Total

15

Last Release

180d ago

Major Versions

1.0.7 → 2.0.02018-07-16

1.2.0 → 2.1.02023-05-31

2.x-dev → 3.0.02025-09-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/40e135ad117686bee39707c1d9286cc5e915e219c26a10d13858ca44d14f1eb0?d=identicon)[dizzystuff](/maintainers/dizzystuff)

---

Top Contributors

[![stevie-mayhew](https://avatars.githubusercontent.com/u/1953220?v=4)](https://github.com/stevie-mayhew "stevie-mayhew (11 commits)")[![hchokshi](https://avatars.githubusercontent.com/u/10136407?v=4)](https://github.com/hchokshi "hchokshi (8 commits)")[![dizzystuff](https://avatars.githubusercontent.com/u/576903?v=4)](https://github.com/dizzystuff "dizzystuff (7 commits)")[![obj63mc](https://avatars.githubusercontent.com/u/443120?v=4)](https://github.com/obj63mc "obj63mc (2 commits)")[![michalkleiner](https://avatars.githubusercontent.com/u/233342?v=4)](https://github.com/michalkleiner "michalkleiner (1 commits)")[![sunnysideup](https://avatars.githubusercontent.com/u/167154?v=4)](https://github.com/sunnysideup "sunnysideup (1 commits)")[![wernerkrauss](https://avatars.githubusercontent.com/u/1043925?v=4)](https://github.com/wernerkrauss "wernerkrauss (1 commits)")[![xini](https://avatars.githubusercontent.com/u/1152403?v=4)](https://github.com/xini "xini (1 commits)")

---

Tags

silverstripecmshas\_one

### Embed Badge

![Health badge](/badges/fromholdio-silverstripe-hasoneedit/health.svg)

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

###  Alternatives

[stevie-mayhew/hasoneedit

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

21225.4k11](/packages/stevie-mayhew-hasoneedit)[praxisnetau/silverstripe-moderno-admin

A SilverStripe module to give the CMS a more modern, flat appearance.

224.4k](/packages/praxisnetau-silverstripe-moderno-admin)

PHPackages © 2026

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