Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/satrun77/silverstripe-hasoneselector
HasOneSelector is a module that provides CMS field to manage data object defined in a has_one relation.
https://github.com/satrun77/silverstripe-hasoneselector
cms-field php silverstripe silverstripe-4 silverstripe-module
Last synced: 10 days ago
JSON representation
HasOneSelector is a module that provides CMS field to manage data object defined in a has_one relation.
- Host: GitHub
- URL: https://github.com/satrun77/silverstripe-hasoneselector
- Owner: satrun77
- License: mit
- Created: 2018-07-09T11:31:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-13T21:10:33.000Z (almost 2 years ago)
- Last Synced: 2024-09-17T05:39:29.627Z (2 months ago)
- Topics: cms-field, php, silverstripe, silverstripe-4, silverstripe-module
- Language: PHP
- Size: 383 KB
- Stars: 3
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# HasOne Selector
[![Build Status](https://scrutinizer-ci.com/g/satrun77/silverstripe-hasoneselector/badges/build.png?b=master)](https://scrutinizer-ci.com/g/satrun77/silverstripe-hasoneselector/build-status/master)
[![Code Coverage](https://scrutinizer-ci.com/g/satrun77/silverstripe-hasoneselector/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/satrun77/silverstripe-hasoneselector/?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/satrun77/silverstripe-hasoneselector/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/satrun77/silverstripe-hasoneselector/?branch=master)
[![Latest Stable Version](https://poser.pugx.org/moo/hasoneselector/v/stable?format=flat)](https://packagist.org/packages/moo/hasoneselector)
[![License](https://poser.pugx.org/moo/hasoneselector/license?format=flat)](https://packagist.org/packages/moo/hasoneselector)HasOneSelector is a module that provides CMS field to manage data object defined in a has_one relation.
## Requirements
* SilverStripe CMS ^5.0
## Installation via Composer
composer require moo/hasoneselector## Usage
```php
use SilverStripe\ORM\DataObject;
use SilverStripe\CMS\Model\SiteTree;
use Moo\HasOneSelector\Form\Field;class Resource extends DataObject
{
//...
}class Page extends SiteTree
{
//...
private static $has_one = [
'Resource' => Resource::class,
];public function getCMSFields()
{
$fields = parent::getCMSFields();$resource = Field::create('Resource', 'Resource', $this, Resource::class);
$fields->addFieldToTab('Root.Main', $resource);return $fields;
}//...
}
```## License
This module is under the MIT license. View the [LICENSE](LICENSE.md) file for the full copyright and license information.