PHP 클래스 Elgg\EntityIconService

Use the elgg_* versions instead.
부터: 2.2
상속: use trait TimeUsing
파일 보기 프로젝트 열기: elgg/elgg

공개 메소드들

메소드 설명
__construct ( Config $config, PluginHooksService $hooks, Request $request, Logger $logger, EntityTable $entities ) Constructor
deleteIcon ( ElggEntity $entity, string $type = 'icon' ) : boolean Removes all icon files and metadata for the passed type of icon.
getFallbackIconUrl ( ElggEntity $entity, array $params = [] ) : string Returns default/fallback icon
getIcon ( ElggEntity $entity, string $size, string $type = 'icon' ) : ElggIcon Returns entity icon as an ElggIcon object The icon file may or may not exist on filestore
getIconLastChange ( ElggEntity $entity, string $size, string $type = 'icon' ) : integer | null Returns the timestamp of when the icon was changed.
getIconURL ( ElggEntity $entity, mixed $params = [] ) : string | void Get the URL for this entity's icon
getSizes ( string $entity_type = null, string $entity_subtype = null, string $type = 'icon' ) : array Returns a configuration array of icon sizes
handleServeIconRequest ( boolean $allow_removing_headers = true ) : BinaryFileResponse Handle request to /serve-icon handler
hasIcon ( ElggEntity $entity, string $size, string $type = 'icon' ) : boolean Returns if the entity has an icon of the passed type.
saveIcon ( ElggEntity $entity, ElggFile $file, string $type = 'icon', array $coords = [] ) : boolean Saves icons using a created temporary file
saveIconFromElggFile ( ElggEntity $entity, ElggFile $file, string $type = 'icon', array $coords = [] ) : boolean Saves icons using a file located in the data store as the source.
saveIconFromLocalFile ( ElggEntity $entity, string $filename, string $type = 'icon', array $coords = [] ) : boolean Saves icons using a local file as the source.
saveIconFromUploadedFile ( ElggEntity $entity, string $input_name, string $type = 'icon', array $coords = [] ) : boolean Saves icons using an uploaded file as the source.

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( Config $config, PluginHooksService $hooks, Request $request, Logger $logger, EntityTable $entities )
$config Config Config
$hooks PluginHooksService Hook registration service
$request Elgg\Http\Request Http request
$logger Logger Logger
$entities Elgg\Database\EntityTable Entity table

deleteIcon() 공개 메소드

Removes all icon files and metadata for the passed type of icon.
public deleteIcon ( ElggEntity $entity, string $type = 'icon' ) : boolean
$entity ElggEntity Entity that owns icons
$type string The name of the icon. e.g., 'icon', 'cover_photo'
리턴 boolean

getFallbackIconUrl() 공개 메소드

Returns default/fallback icon
public getFallbackIconUrl ( ElggEntity $entity, array $params = [] ) : string
$entity ElggEntity Entity
$params array Icon params
리턴 string

getIcon() 공개 메소드

Returns entity icon as an ElggIcon object The icon file may or may not exist on filestore
public getIcon ( ElggEntity $entity, string $size, string $type = 'icon' ) : ElggIcon
$entity ElggEntity Entity that owns the icon
$size string Size of the icon
$type string The name of the icon. e.g., 'icon', 'cover_photo'
리턴 ElggIcon

getIconLastChange() 공개 메소드

Returns the timestamp of when the icon was changed.
public getIconLastChange ( ElggEntity $entity, string $size, string $type = 'icon' ) : integer | null
$entity ElggEntity Entity that owns the icon
$size string The size of the icon
$type string The name of the icon. e.g., 'icon', 'cover_photo'
리턴 integer | null A unix timestamp of when the icon was last changed, or null if not set.

getIconURL() 공개 메소드

Plugins can register for the 'entity:icon:url', plugin hook to customize the icon for an entity.
public getIconURL ( ElggEntity $entity, mixed $params = [] ) : string | void
$entity ElggEntity Entity that owns the icon
$params mixed A string defining the size of the icon (e.g. tiny, small, medium, large) or an array of parameters including 'size'
리턴 string | void

getSizes() 공개 메소드

Returns a configuration array of icon sizes
public getSizes ( string $entity_type = null, string $entity_subtype = null, string $type = 'icon' ) : array
$entity_type string Entity type
$entity_subtype string Entity subtype
$type string The name of the icon. e.g., 'icon', 'cover_photo'
리턴 array

handleServeIconRequest() 공개 메소드

Handle request to /serve-icon handler
public handleServeIconRequest ( boolean $allow_removing_headers = true ) : BinaryFileResponse
$allow_removing_headers boolean Alter PHP's global headers to allow caching
리턴 Symfony\Component\HttpFoundation\BinaryFileResponse

hasIcon() 공개 메소드

Returns if the entity has an icon of the passed type.
public hasIcon ( ElggEntity $entity, string $size, string $type = 'icon' ) : boolean
$entity ElggEntity Entity that owns the icon
$size string The size of the icon
$type string The name of the icon. e.g., 'icon', 'cover_photo'
리턴 boolean

saveIcon() 공개 메소드

Saves icons using a created temporary file
public saveIcon ( ElggEntity $entity, ElggFile $file, string $type = 'icon', array $coords = [] ) : boolean
$entity ElggEntity Temporary ElggFile instance
$file ElggFile Temporary ElggFile instance
$type string The name of the icon. e.g., 'icon', 'cover_photo'
$coords array An array of cropping coordinates x1, y1, x2, y2
리턴 boolean

saveIconFromElggFile() 공개 메소드

Saves icons using a file located in the data store as the source.
public saveIconFromElggFile ( ElggEntity $entity, ElggFile $file, string $type = 'icon', array $coords = [] ) : boolean
$entity ElggEntity Entity to own the icons
$file ElggFile An ElggFile instance
$type string The name of the icon. e.g., 'icon', 'cover_photo'
$coords array An array of cropping coordinates x1, y1, x2, y2
리턴 boolean

saveIconFromLocalFile() 공개 메소드

Saves icons using a local file as the source.
public saveIconFromLocalFile ( ElggEntity $entity, string $filename, string $type = 'icon', array $coords = [] ) : boolean
$entity ElggEntity Entity to own the icons
$filename string The full path to the local file
$type string The name of the icon. e.g., 'icon', 'cover_photo'
$coords array An array of cropping coordinates x1, y1, x2, y2
리턴 boolean

saveIconFromUploadedFile() 공개 메소드

Saves icons using an uploaded file as the source.
public saveIconFromUploadedFile ( ElggEntity $entity, string $input_name, string $type = 'icon', array $coords = [] ) : boolean
$entity ElggEntity Entity to own the icons
$input_name string Form input name
$type string The name of the icon. e.g., 'icon', 'cover_photo'
$coords array An array of cropping coordinates x1, y1, x2, y2
리턴 boolean