Section API¶
Sections enable you to divide content into groups which can later be used, for example, as basis for permissions.
You can manage sections by using the PHP API by using SectionService
.
Section REST API
To learn how to manage sections using the REST API, see REST API reference.
Creating sections¶
To create a new section, you need to make use of the SectionCreateStruct
and pass it to the SectionService::createSection
method:
1 2 3 4 |
|
Getting section information¶
You can use SectionService
to retrieve section information such as whether it's in use:
1 2 3 4 5 |
|
Listing content in a section¶
To list content items assigned to a section you need to make a query for content belonging to this section, by applying the SearchService
.
You can also use the query to get the total number of assigned content items:
1 2 3 4 5 6 7 8 9 10 |
|
Assigning section to content¶
To assign content to a section, use the SectionService::assignSection
method.
You need to provide it with the ContentInfo
object of the content item, and the Section
object:
1 2 3 |
|
Assigning a section to content doesn't automatically assign it to the content item's children.