Skip to content

UserAdapter ​

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

View source

Protected Properties ​

PropertyDescription
elementSerializer
lifecycle

Public Methods ​

MethodDescription
__construct()
canDelete()
canView()
create()
createUnpublishedDraft()
duplicate()
elementType()
fieldSchemaElement()
find()
handle()
listQuery()
prepareValidation()
schema()
serialize()
update()

__construct() ​

View source

Arguments ​

  • $elementSerializer
  • $lifecycle
  • $users
  • $editionFeatures

canDelete() ​

View source

Arguments ​

  • $actor
  • $element

canView() ​

View source

Arguments ​

  • $actor
  • $element

create() ​

View source

Arguments ​

  • $attributes
  • $fields
  • $actor

elementType() ​

View source

find() ​

View source

Arguments ​

  • $id
  • $uid
  • $siteId

handle() ​

View source

listQuery() ​

View source

Arguments ​

  • $actor

prepareValidation() ​

View source

Arguments ​

  • $element
  • $attributes
  • $fields
  • $actor

serialize() ​

View source

Arguments ​

update() ​

View source

Arguments ​

  • $element
  • $attributes
  • $fields
  • $actor

Protected Methods ​

MethodDescription
authorizeSave()
createAttributesSchema()
criteriaProperties()
duplicateModes()
fieldSchemaContextSchema()Returns the JSON Schema for the context that selects a new element's field layout, or null if the type has one field layout.
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()

createAttributesSchema() ​

View source

criteriaProperties() ​

View source

notes() ​

View source

updateAttributesSchema() ​

View source

Constants ​

ConstantDescription
UnrestrictedAttributesAttributes non-admins may set on any user they are allowed to save.