PHP Класс Elgg\EntityIconService

Use the elgg_* versions instead.
С версии: 2.2
Наследование: use trait TimeUsing
Показать файл Открыть проект

Открытые методы

Метод Описание
__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