moo / hasoneselector
This module provides CMS field to manage data object defined in a has_one relation.
Installs: 21 446
Dependents: 1
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 5
Open Issues: 0
Type:silverstripe-vendormodule
Requires
- php: >=7.4
- silverstripe/framework: ^4.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.2
- phpstan/phpstan: ~0.12.80
- silverstripe/recipe-testing: ^2
- symbiote/silverstripe-phpstan: dev-php8-support
README
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
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 file for the full copyright and license information.