mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX Improve GridFieldViewButton to work with new Archive Admin (#8240)
* Add gridfield restore action, enable view button in action menu * Abstract restore action and create test * Use more appropriate canRestoreToDraft and isArchived, move translations * Use Hierarchy to determine if a record should be restored to root * Move restore action to versioned
This commit is contained in:
parent
6e00d90783
commit
599a4420bf
@ -97,6 +97,8 @@ en:
|
||||
Save: Save
|
||||
SilverStripe\Forms\GridField\GridFieldEditButton:
|
||||
EDIT: Edit
|
||||
SilverStripe\Forms\GridField\GridFieldViewButton:
|
||||
VIEW: View
|
||||
SilverStripe\Forms\GridField\GridFieldGroupDeleteAction:
|
||||
UnlinkSelfFailure: 'Cannot remove yourself from this group, you will lose admin rights'
|
||||
SilverStripe\Forms\GridField\GridFieldPaginator:
|
||||
|
@ -11,8 +11,41 @@ use SilverStripe\View\SSViewer;
|
||||
* disabled by default and intended for use in readonly {@link GridField}
|
||||
* instances.
|
||||
*/
|
||||
class GridFieldViewButton implements GridField_ColumnProvider
|
||||
class GridFieldViewButton implements GridField_ColumnProvider, GridField_ActionMenuLink
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getTitle($gridField, $record, $columnName)
|
||||
{
|
||||
return _t(__CLASS__ . '.VIEW', "View");
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getGroup($gridField, $record, $columnName)
|
||||
{
|
||||
return GridField_ActionMenuItem::DEFAULT_GROUP;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getExtraData($gridField, $record, $columnName)
|
||||
{
|
||||
return [
|
||||
"classNames" => "font-icon-eye action-detail view-link"
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getUrl($gridField, $record, $columnName)
|
||||
{
|
||||
return Controller::join_links($gridField->Link('item'), $record->ID, 'view');
|
||||
}
|
||||
|
||||
public function augmentColumns($field, &$columns)
|
||||
{
|
||||
|
@ -1,3 +1,3 @@
|
||||
<a class="grid-field__icon-action font-icon-right-open btn--icon-large action action-detail view-link" href="$Link">
|
||||
<a class="grid-field__icon-action font-icon-right-open btn--icon-large action action-detail view-link action-menu--handled" href="$Link">
|
||||
<span class="sr-only">View</span>
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user