Skip to content

Commit

Permalink
DOC Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Nov 29, 2023
1 parent e95916b commit 79b26e1
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,10 @@ This module provides a Link model and CMS interface for managing different types

Installation via composer.

### Silverstripe 5

```sh
composer require silverstripe/linkfield
```

### GraphQL v4 - Silverstripe 4

`composer require silverstripe/linkfield:^2`

### GraphQL v3 - Silverstripe 4

```sh
composer require silverstripe/linkfield:^1
```

## Sample usage

```php
Expand All @@ -43,22 +31,30 @@ use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\LinkField\ORM\DBLink;
use SilverStripe\LinkField\Models\Link;
use SilverStripe\LinkField\Form\LinkField;
use SilverStripe\LinkField\Form\MultiLinkField;

class Page extends SiteTree
{
private static array $has_one = [
'HasOneLink' => Link::class,
];

private static $many_many = [
'Links' => Link::class
];

public function getCMSFields()
{
$fields = parent::getCMSFields();

// Don't forget to remove the auto-scaffolded fields!
$fields->removeByName(['HasOneLinkID', 'Links']);

$fields->addFieldsToTab(
'Root.Main',
[
LinkField::create('HasOneLink'),
LinkField::create('DbLink'),
MultiLinkField::create('Links'),
],
);

Expand All @@ -67,19 +63,11 @@ class Page extends SiteTree
}
```

## Migrating from Version `1.0.0` or `dev-master`

Please be aware that in early versions of this module (and in untagged `dev-master`) there were no table names defined
for our `Link` classes. These have now all been defined, which may mean that you need to rename your old tables, or
migrate the data across.

EG: `SilverStripe_LinkField_Models_Link` needs to be migrated to `LinkField_Link`.

## Migrating from Shae Dawson's Linkable module

https://github.com/sheadawson/silverstripe-linkable

Shae Dawson's Linkable module was a much loved, and much used module. It is, unfortunately, no longer maintained. We
have provided some steps and tasks that we hope can be used to migrate your project from Linkable to LinkField.

* [Migraiton docs](docs/en/linkable-migration.md)
* [Migration docs](docs/en/linkable-migration.md)

0 comments on commit 79b26e1

Please sign in to comment.