Skip to content

Fields ​

Type
Class
Namespace
craft\mcp\capabilities
Inherits
craft\mcp\capabilities\Fields
Since
5.12.0

View source

Public Methods ​

MethodDescription
__construct()
create()
delete()
get()
list()
resource()
resourceByIdentifier()
update()

__construct() ​

View source

Arguments ​

  • $fields
  • $sensitiveValues

create() ​

View source

Arguments ​

  • $type (string) – Registered field class name, such as craft\fields\PlainText.
  • $name
  • $handle
  • $instructions
  • $searchable
  • $translationMethod
  • $translationKeyFormat
  • $settings (array<string,mixed>) – Type-specific field settings.

Returns ​

array{field: array<string,mixed>}

delete() ​

View source

Arguments ​

  • $id
  • $uid
  • $handle

Returns ​

array{deleted: true}

get() ​

View source

Arguments ​

  • $id
  • $uid
  • $handle

Returns ​

array{field: array<string,mixed>}

list() ​

View source

Returns ​

array{count: int, fields: list<array<string,mixed>>}

resource() ​

View source

Returns ​

array{count: int, fields: list<array<string,mixed>>}

resourceByIdentifier() ​

View source

Arguments ​

  • $field

Returns ​

array{field: array<string,mixed>}

update() ​

View source

Arguments ​

  • $context
  • $id
  • $uid
  • $currentHandle (string, null) – Existing field handle.
  • $name (string, null) – Field name.
  • $handle (string, null) – New field handle.
  • $instructions (string, null) – Field instructions.
  • $searchable (boolean) – Whether the field contributes search keywords.
  • $translationMethod (string) – Field translation method.
  • $translationKeyFormat (string, null) – Custom translation key format.
  • $settings (array<string,mixed>) – Type-specific field settings to update.

Returns ​

array{field: array<string,mixed>}