PHPackages                             owl/hasmany - 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. owl/hasmany

AbandonedArchivedLibrary

owl/hasmany
===========

Has-many / belongs-to relation subforms.

27844[2 PRs](https://github.com/october-widgets/hasmany/pulls)JavaScript

Since Apr 9Pushed 9y ago1 watchersCompare

[ Source](https://github.com/october-widgets/hasmany)[ Packagist](https://packagist.org/packages/owl/hasmany)[ RSS](/packages/owl-hasmany/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Hasmany
=======

[](#hasmany)

Has-many/belongs-to popup widget for [OctoberCMS](http://octobercms.com).

[![Packagist](https://camo.githubusercontent.com/2a78989a5bb00899f91a649679a4dea68a79c030f36def9ec1a6a8f1688659b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f776c2f6861736d616e792e737667)](https://camo.githubusercontent.com/2a78989a5bb00899f91a649679a4dea68a79c030f36def9ec1a6a8f1688659b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f776c2f6861736d616e792e737667)

### Installation

[](#installation)

To install the Hasmany widget, add the following to your plugin's `composer.json` file.

```
"require": {
    "owl/hasmany": "~1.0@dev"
}
```

Next, register the widget in your `Plugin.php` file.

```
public function registerFormWidgets()
{
    return [
        'Owl\FormWidgets\HasMany\Widget' => [
            'label' => 'Hasmany',
            'code'  => 'owl-hasmany'
        ],
    ];
}
```

### Usage

[](#usage)

First things first, you'll need to have a pair of models related via a has-many / belongs-to relationship. From there, in your parent model's fields.yaml file use the relationship name as the field name, and `owl-hasmany` as the type.

```
relationship:
    type: owl-hasmany
```

Next, you'll need to define the default parameters, or a custom partial. The default parameters will create a list that is very similar to the Sitemap plugin's UI. You may use basic twig markup inside these fields, variable names will reference model attributes. The `icon` option should be a valid [Font-Autumn](http://daftspunk.github.io/Font-Autumn/) icon class, or `false`.

```
relationship:
    type: owl-hasmany
    default:
        icon: icon-file-o
        label: "{{ name }}"
        comment: "{{ description }}"
```

To customize the widget appearance, you may also define a custom partial instead of the default.

```
relationship:
    type: owl-hasmany
    partial: @/plugins/author/plugin/models/relationship/_partial.htm
```

There are a few additional parameters available to customize the widget's appearance. Defining a `sortColumn` enables drag-and-drop re-ordering. This value should reference the model's "order by" column name. Defining a `formHeader` will change the default header of popup windows. Defining an `addLabel` or `addIcon` will customize the appearance of the add button. `addLabel`.

Javascript events will be triggered when a popup window is opened or closed. Listening for these events can be useful when you wish to show / hide fields based on form values.

```
$(document).bind("owl.hasmany.opened", function(e, data) {
    // popup was opened
});
$(document).bind("owl.hasmany.closed", function(e, data) {
    // popup was closed
});
```

The `data` array will contain 3 keys. `data.alias` refers to the widget alias, `data.item` refers to the popup's cooresponding li element, and `data.form` references the popup form element.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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/904cc72c102eb3725fdc5191aaf7519724839af6feb847dc20dfa138f37e50b2?d=identicon)[scottbedard](/maintainers/scottbedard)

---

Top Contributors

[![scottbedard](https://avatars.githubusercontent.com/u/7980426?v=4)](https://github.com/scottbedard "scottbedard (19 commits)")

### Embed Badge

![Health badge](/badges/owl-hasmany/health.svg)

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

PHPackages © 2026

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