PHP code example of cyber-duck / silverstripe-linkitemfield
1. Go to this page and download the library: Download cyber-duck/silverstripe-linkitemfield library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cyber-duck / silverstripe-linkitemfield example snippets
use CyberDuck\LinkItemField\Forms\LinkItemField;
use CyberDuck\LinkItemField\Model\LinkItem;
use SilverStripe\ORM\DataObject;
class MyObject extends DataObject
{
private static has_one = [
'MyRelation' => LinkItem::class
];
}
$fields->addFieldToTab('Root.Main', LinkItemField::create('MyRelationID', 'My Relation Title'));