PHP code example of fromholdio / silverstripe-superlinker
1. Go to this page and download the library: Download fromholdio/silverstripe-superlinker 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/ */
fromholdio / silverstripe-superlinker example snippets
// for $has_one relation, testing inline fields
$linkFields = SuperLink::singleton()->getCMSLinkFields('SuperLink' . HasOneEdit::FIELD_SEPARATOR);
$fields->addFieldsToTab('Root.Main', $linkFields->toArray());
// for $has_one relation, testing with edit form
$fields->addFieldsToTab('Root.Main', [
HasOneMiniGridField::create(
'SuperLink',
'SuperLink',
$this
)
]);
// for $has_many relation, testing with gridfield
$linksField = MiniGridField::create(
'SuperLinks',
'Links',
$this
)->setLimit(7)->setShowLimitMessage(true);
$fields->addFieldToTab('Root.Main', $linksField);
// for the HasOne/MiniGridFields, currently adding these lines provides nicer UI
$config = $linksField->getGridConfig()?->addComponent(new GridField_ActionMenu());
$linksField->setGridConfig($config);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.