src/GridFieldArchiveAction.php
public function getArchiveAction($gridField, $record)
    {
        /* @var DataObject|Versioned $record */
        if (!$record->hasMethod('canArchive') || !$record->canArchive()) {
            return null;
        }

        $title = _t(__CLASS__ . '.Archive', "Archive");

        $field = GridField_FormAction::create(
            $gridField,
            'ArchiveRecord' . $record->ID,
            false,
            "archiverecord",
            ['RecordID' => $record->ID]
        )
            ->addExtraClass('action--archive btn--icon-md font-icon-box btn--no-text grid-field__icon-action action-menu--handled')
            ->setAttribute('classNames', 'action--archive font-icon-box')
            ->setDescription($title)
            ->setAttribute('aria-label', $title);

        return $field;
    }
public function getArchiveAction($gridField, $record)
    {
        /* @var DataObject|Versioned $record */
        if (!$record->hasMethod('canArchive') || !$record->canArchive()) {
            return null;
        }

        $title = _t(__CLASS__ . '.Archive', "Archive");

        $field = GridField_FormAction::create(
            $gridField,
            'ArchiveRecord' . $record->ID,
            false,
            "archiverecord",
            ['RecordID' => $record->ID]
        )
            ->addExtraClass('action--archive btn--icon-md font-icon-box btn--no-text grid-field__icon-action action-menu--handled')
            ->setAttribute('classNames', 'action--archive font-icon-box')
            ->setDescription($title)
            ->setAttribute('aria-label', $title);

        return $field;
    }
public function getArchiveAction ( $ gridField , $ record ) { /* @var DataObject|Versioned $record */ if ( ! $ record -> hasMethod ( 'canArchive' ) || ! $ record -> canArchive ( ) ) { return null ; } $ title = _t ( __CLASS__ . '.Archive' , "Archive" ) ; $ field = GridField_FormAction :: create ( $ gridField , 'ArchiveRecord' . $ record -> ID , false , "archiverecord" , [ 'RecordID' => $ record -> ID ] ) -> addExtraClass ( 'action--archive btn--icon-md font-icon-box btn--no-text grid-field__icon-action action-menu--handled' ) -> setAttribute ( 'classNames' , 'action--archive font-icon-box' ) -> setDescription ( $ title ) -> setAttribute ( 'aria-label' , $ title ) ; return $ field ; }
Returns the GridField_FormAction if archive can be performed

@param GridField $gridField
@param DataObject $record
@return GridField_FormAction|null
Returns the GridField_FormAction if archive can be performed