code/Controller/AssetAdmin.php
public function getObjectFromData(File $file, $thumbnailLinks = true)
    {
        $object = $this->getMinimalistObjectFromData($file, $thumbnailLinks);

        // Slightly more accurate than graphql bulk-usage lookup, but more expensive
        $object['inUseCount'] = ($file->hasMethod('findOwners')) ? $file->findOwners()->count() : 0;
        $object['created'] = $file->Created;
        $object['lastUpdated'] = $file->LastEdited;
        $object['owner'] = null;
        $object['type'] = $file instanceof Folder ? 'folder' : $file->FileType;
        $object['name'] = $file->Name;
        $object['filename'] = $file->Filename;
        $object['url'] = $file->AbsoluteURL;
        $object['canEdit'] = $file->canEdit();
        $object['canDelete'] = ($file->hasMethod('canArchive')) ? $file->canArchive() : $file->canDelete();

        /** @var Member $owner */
        $owner = $file->Owner();

        if ($owner) {
            $object['owner'] = array(
                'id' => $owner->ID,
                'title' => $owner->Name,
            );
        }

        return $object;
    }
public function getObjectFromData(File $file, $thumbnailLinks = true)
    {
        $object = $this->getMinimalistObjectFromData($file, $thumbnailLinks);

        // Slightly more accurate than graphql bulk-usage lookup, but more expensive
        $object['inUseCount'] = ($file->hasMethod('findOwners')) ? $file->findOwners()->count() : 0;
        $object['created'] = $file->Created;
        $object['lastUpdated'] = $file->LastEdited;
        $object['owner'] = null;
        $object['type'] = $file instanceof Folder ? 'folder' : $file->FileType;
        $object['name'] = $file->Name;
        $object['filename'] = $file->Filename;
        $object['url'] = $file->AbsoluteURL;
        $object['canEdit'] = $file->canEdit();
        $object['canDelete'] = ($file->hasMethod('canArchive')) ? $file->canArchive() : $file->canDelete();

        /** @var Member $owner */
        $owner = $file->Owner();

        if ($owner) {
            $object['owner'] = array(
                'id' => $owner->ID,
                'title' => $owner->Name,
            );
        }

        return $object;
    }
public function getObjectFromData ( File $ file , $ thumbnailLinks = true ) { $ object = $ this -> getMinimalistObjectFromData ( $ file , $ thumbnailLinks ) ; // Slightly more accurate than graphql bulk-usage lookup, but more expensive $ object [ 'inUseCount' ] = ( $ file -> hasMethod ( 'findOwners' ) ) ? $ file -> findOwners ( ) -> count ( ) : 0 ; $ object [ 'created' ] = $ file -> Created ; $ object [ 'lastUpdated' ] = $ file -> LastEdited ; $ object [ 'owner' ] = null ; $ object [ 'type' ] = $ file instanceof Folder ? 'folder' : $ file -> FileType ; $ object [ 'name' ] = $ file -> Name ; $ object [ 'filename' ] = $ file -> Filename ; $ object [ 'url' ] = $ file -> AbsoluteURL ; $ object [ 'canEdit' ] = $ file -> canEdit ( ) ; $ object [ 'canDelete' ] = ( $ file -> hasMethod ( 'canArchive' ) ) ? $ file -> canArchive ( ) : $ file -> canDelete ( ) ; /** @var Member $owner */ $ owner = $ file -> Owner ( ) ; if ( $ owner ) { $ object [ 'owner' ] = array ( 'id' => $ owner -> ID , 'title' => $ owner -> Name , ) ; } return $ object ; }
Build the array containing the all attributes the AssetAdmin client interact with.
@param File $file
@param bool $thumbnailLinks Set to true if thumbnail links should be included.
Set to false to skip thumbnail link generation.
Note: Thumbnail content is always generated to pre-optimise for future use, even if
links are not generated.
@return array
Build the array containing the all attributes the AssetAdmin client interact with .