2017 © Pedro Peláez
 

silverstripe-vendormodule silverstripe-hasonefield

Edit a has_one relationship using the gridfield editor, triggered by clicking a button.

image

silvershop/silverstripe-hasonefield

Edit a has_one relationship using the gridfield editor, triggered by clicking a button.

  • Monday, February 5, 2018
  • by anselmdk
  • Repository
  • 5 Watchers
  • 19 Stars
  • 3,619 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 11 Forks
  • 3 Open issues
  • 5 Versions
  • 60 % Grown

The README.md

SilverStripe has_one field

Build Status Latest Stable Version Latest Unstable Version, (*1)

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., (*2)

demo, (*3)

Installation

composer require silvershop/silverstripe-hasonefield

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., (*4)

Filtering Results

To filter the results shown in the picker use HasOneAddExistingAutoCompleter::setSearchList., (*5)

$property = HasOneButtonField::create(
    $this,
    'Address'
);

$property
    ->getConfig()
    ->getComponentByType(HasOneAddExistingAutoCompleter::class)
    ->setSearchList(Property::get()->filter("Country", "GB"));

$fields->addFieldToTab(
    'Root.Main',
    $property
);

The Versions

05/02 2018

dev-master

9999999-dev

Edit a has_one relationship using the gridfield editor, triggered by clicking a button.

  Sources   Download

BSD-2-Clause BSD-2

The Requires

 

05/02 2018

2.0-alpha2

2.0.0.0-alpha2

Edit a has_one relationship using the gridfield editor, triggered by clicking a button.

  Sources   Download

BSD-2-Clause

The Requires

 

28/01 2018

1.x-dev

1.9999999.9999999.9999999-dev

Edit a has_one relationship using the gridfield editor, triggered by clicking a button.

  Sources   Download

BSD-2-Clause BSD-2

28/01 2018

2.0-alpha1

2.0.0.0-alpha1

Edit a has_one relationship using the gridfield editor, triggered by clicking a button.

  Sources   Download

BSD-2-Clause

The Requires

 

21/02 2016

1.0.0

1.0.0.0

Edit a has_one relationship using the gridfield editor, triggered by clicking a button.

  Sources   Download

BSD-2