PHP code example of taitava / silverstripe-cmseditlink
1. Go to this page and download the library: Download taitava/silverstripe-cmseditlink 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/ */
taitava / silverstripe-cmseditlink example snippets
class Book extends DataObject
{
private static $has_one = [
'Library' => Library::class,
];
public function ProvideCMSEditLink($action)
{
if ($action == 'edit') $action = 'tagAuthors'; // Switch the default 'edit' action to an author tagging action, or whatever.
$link = CMSEditLink::LinkFor($this,$action);
$link->via($this->Library(), 'Books'); // Scaffold the link via the book's holder Library
return $link; // The alterations made in this function ...
}
}
class Library extends DataObject
{
private static $has_many = [
'Books' => Book::class,
];
}
$book = Book::get()->byID(1);
$link = $book->CMSEditLink(); // ... will be in place here.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.