Source of file GridFieldListedPagesEditButton.php
Size: 1,090 Bytes - Last Modified: 2021-12-24T06:48:31+00:00
/var/www/docs.ssmods.com/process/src/src/Forms/GridFieldListedPagesEditButton.php
1234567891011121314151617181920212223242526272829303132333435363738 | <?php namespace Fromholdio\Listings\Forms; use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridFieldEditButton; use SilverStripe\ORM\DataObject; use SilverStripe\View\ArrayData; /** * Swaps the GridField Link out for the SiteTree edit link using {@link SiteTree::CMSEditLink()}. * * Bypasses GridFieldDetailForm * * @author Michael Strong <mstrong@silverstripe.org> **/ class GridFieldListedPagesEditButton extends GridFieldEditButton { /** * @param GridField $gridField * @param DataObject $record * @param string $columnName * @return string - the HTML for the column */ public function getColumnContent($gridField, $record, $columnName) { // No permission checks - handled through GridFieldDetailForm // which can make the form readonly if no edit permissions are available. $data = ArrayData::create([ 'Link' => $record->CMSEditLink(), 'ExtraClass' => $this->getExtraClass(), ]); return $data->renderWith(GridFieldEditButton::class); } } |