code/Forms/FileFormFactory.php
protected function getUnpublishAction($record)
    {
        // Check if record is unpublishable
        if (!$record || !$record->isInDB() || !$record->isPublished() || !$record->canUnpublish()) {
            return null;
        }

        // Count live owners
        /** @var Versioned|RecursivePublishable $liveRecord */
        $liveRecord = Versioned::get_by_stage($record->baseClass(), Versioned::LIVE)
            ->byID($record->ID);
        $liveOwners = $liveRecord->findOwners(false)->count();

        // Build action
        $unpublishText = _t(
            'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.UNPUBLISH_BUTTON',
            'Unpublish'
        );
        $action = FormAction::create('unpublish', $unpublishText)
            ->setIcon('cancel-circled')
            ->setSchemaData(['data' => ['owners' => $liveOwners]]);
        return $action;
    }
protected function getUnpublishAction($record)
    {
        // Check if record is unpublishable
        if (!$record || !$record->isInDB() || !$record->isPublished() || !$record->canUnpublish()) {
            return null;
        }

        // Count live owners
        /** @var Versioned|RecursivePublishable $liveRecord */
        $liveRecord = Versioned::get_by_stage($record->baseClass(), Versioned::LIVE)
            ->byID($record->ID);
        $liveOwners = $liveRecord->findOwners(false)->count();

        // Build action
        $unpublishText = _t(
            'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.UNPUBLISH_BUTTON',
            'Unpublish'
        );
        $action = FormAction::create('unpublish', $unpublishText)
            ->setIcon('cancel-circled')
            ->setSchemaData(['data' => ['owners' => $liveOwners]]);
        return $action;
    }
protected function getUnpublishAction ( $ record ) { // Check if record is unpublishable if ( ! $ record || ! $ record -> isInDB ( ) || ! $ record -> isPublished ( ) || ! $ record -> canUnpublish ( ) ) { return null ; } // Count live owners /** @var Versioned|RecursivePublishable $liveRecord */ $ liveRecord = Versioned :: get_by_stage ( $ record -> baseClass ( ) , Versioned :: LIVE ) -> byID ( $ record -> ID ) ; $ liveOwners = $ liveRecord -> findOwners ( false ) -> count ( ) ; // Build action $ unpublishText = _t ( 'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.UNPUBLISH_BUTTON' , 'Unpublish' ) ; $ action = FormAction :: create ( 'unpublish' , $ unpublishText ) -> setIcon ( 'cancel-circled' ) -> setSchemaData ( [ 'data' => [ 'owners' => $ liveOwners ] ] ) ; return $ action ; }
Get action for publishing

@param File $record
@return FormAction
Get action for publishing