Download the PHP package sunnysideup/hasoneedit without Composer

On this page you can find all versions of the php package sunnysideup/hasoneedit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package hasoneedit

Has One Edit

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

SilverStripe 4.x.

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

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

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 FormFields for that object. Those FormFields 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

To add support to your own forms, you need to add the Sunnysideup\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.


All versions of hasoneedit with dependencies

PHP Build Version
Package Version
Requires silverstripe/framework Version ~4.0 || ~5.0
silverstripe/asset-admin Version ~1.0 || ~2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sunnysideup/hasoneedit contains the following files

Loading the files please wait ....