Skip to content

AssetAdapter ​

Type
Class
Namespace
craft\mcp\elements\adapters
Inherits
craft\mcp\elements\adapters\AssetAdapter » craft\mcp\elements\BaseElementAdapter
Implements
craft\mcp\elements\ElementAdapter
Since
5.12.0

View source

Protected Properties ​

PropertyDescription
elementSerializer
lifecycle

Public Methods ​

MethodDescription
__construct()
authorizeAssetSave()Checks that the actor may save the asset.
canDelete()
canView()
create()
createUnpublishedDraft()
duplicate()
elementType()
fieldSchemaElement()
find()
handle()
listQuery()
prepareValidation()
schema()
serialize()
targetFolder()Resolves an upload destination from exactly one of a folder ID or a volume ID.
update()

__construct() ​

View source

Arguments ​

  • $elementSerializer
  • $lifecycle
  • $assets
  • $folders

authorizeAssetSave() ​

Checks that the actor may save the asset.

View source

Arguments ​

  • $actor
  • $asset

create() ​

View source

Arguments ​

  • $attributes
  • $fields
  • $actor

elementType() ​

View source

fieldSchemaElement() ​

View source

Arguments ​

handle() ​

View source

prepareValidation() ​

View source

Arguments ​

targetFolder() ​

Resolves an upload destination from exactly one of a folder ID or a volume ID.

View source

Arguments ​

  • $folderId
  • $volumeId

update() ​

View source

Arguments ​

Protected Methods ​

MethodDescription
authorizeSave()
createAttributesSchema()Returns the JSON Schema for attributes elements.create accepts, or null if it cannot create this type.
criteriaProperties()
duplicateModes()
fieldSchemaContextSchema()
findQuery()Returns the query find() loads an element with.
newElement()Returns a new, unsaved element.
notes()
populate()Applies validated attributes and custom field values to an element.
prepareCreate()Returns a new element populated with the given values, after authorizing the actor to save it.
save()
saveElement()Saves an element as the acting user and returns the saved element, which may be a new draft.
saveFailed()
setFieldValues()Sets custom field values given in the format elements.field-schema describes.
updateAttributesSchema()

criteriaProperties() ​

View source

fieldSchemaContextSchema() ​

View source

notes() ​

View source

updateAttributesSchema() ​

View source