Source of file CMSNicetiesLinkButton.php
Size: 1,135 Bytes - Last Modified: 2021-12-23T10:39:07+00:00
/var/www/docs.ssmods.com/process/src/src/Forms/CMSNicetiesLinkButton.php
12345678910111213141516171819202122232425262728293031323334353637383940414243 | <?php namespace Sunnysideup\CMSNiceties\Forms; use SilverStripe\Forms\ReadonlyField; use SilverStripe\ORM\FieldType\DBField; use SilverStripe\View\ViewableData; // use SilverStripe\Forms\GridField\GridFieldArchiveAction; class CMSNicetiesLinkButton extends ReadonlyField { protected $link = ''; protected $label = ''; /** * Creates a new field. * * @param string $name the internal field name, passed to forms * @param null|string|ViewableData $label the human-readable field label * @param mixed $link the value of the field */ public function __construct($name, $label = null, $link = null) { $title = '🚀'; $this->link = $link; $this->label = $label; parent::__construct($name, $title, $link); } public function Value() { return DBField::create_field( 'HTMLText', '<a href="' . $this->link . '" class="btn action btn-outline-primary" target="_blank"> <span class="btn__title">' . $this->label . '</span> </a>' ); } } |