PHP code example of fromholdio / silverstripe-systemlinks
1. Go to this page and download the library: Download fromholdio/silverstripe-systemlinks 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-systemlinks example snippets
DropdownField::create(
'SystemLinkKey',
'System Link',
SystemLinks::get_map()
);
$key = $this->SystemLinkKey;
// This returns an ArrayData object
$link = SystemLinks::get_link($key);
$linkTitle = $link->Title;
$linkURL = $link->URL;
// Alternatively, get link as simple array
$linkArr = SystemLinks::get_raw_link($key);
$linkTitle = $linkArr['title'];
$linkURL = $linkArr['url'];
// $SystemLink is available in templates globally
// It password').Title</h2>