Skip to content

Sections ​

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

View source

Public Methods ​

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

__construct() ​

View source

Arguments ​

  • $sections

create() ​

View source

Arguments ​

  • $name
  • $handle
  • $type
  • $entryTypes (list<int|string|array<string,mixed>>) – Existing entry type references or usage configs.
  • $siteSettings (list<array<string,mixed>>) – Per-site section settings.
  • $minAuthors
  • $maxAuthors
  • $maxLevels
  • $enableVersioning
  • $propagationMethod
  • $defaultPlacement
  • $previewTargets (list<array{label: string, urlFormat: string}>, null) – Preview target configs.

Returns ​

array{section: array<string,mixed>}

delete() ​

View source

Arguments ​

  • $id
  • $uid
  • $handle

Returns ​

array{deleted: true}

get() ​

View source

Arguments ​

  • $id
  • $uid
  • $handle

Returns ​

array{section: array<string,mixed>}

list() ​

View source

Returns ​

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

resource() ​

View source

Returns ​

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

resourceByIdentifier() ​

View source

Arguments ​

  • $section

Returns ​

array{section: array<string,mixed>}

update() ​

View source

Arguments ​

  • $context
  • $id
  • $uid
  • $currentHandle (string, null) – Existing section handle.
  • $name
  • $handle
  • $type
  • $entryTypes (list<int|string|array<string,mixed>>) – Existing entry type references or usage configs.
  • $siteSettings (list<array<string,mixed>>) – Per-site section settings.
  • $minAuthors
  • $maxAuthors
  • $maxLevels
  • $enableVersioning
  • $propagationMethod
  • $defaultPlacement
  • $previewTargets (list<array{label: string, urlFormat: string}>, null) – Preview target configs; null restores the default target.

Returns ​

array{section: array<string,mixed>}

Constants ​

ConstantDescription
EntryTypesSchema
PreviewTargetsSchema
SiteSettingsSchema