Repository API¶
Sections¶
Sections enable you to divide content into groups which can later be used e.g. as basis for permissions.
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 is in use:
1 2 3 4 |
|
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 |
|
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 |
|
Note that assigning a Section to content does not automatically assign it to the Content item's children.
Object states¶
Object states enable you to set a custom state to any content. States are grouped into Object state groups.
Getting Object state information¶
You can use the ObjectStateService
to get information about Object state groups or Object states.
1 2 3 4 5 |
|
Creating Object states¶
To create an Object state group and add Object states to it,
you need to make use of the ObjectStateService
:
1 2 3 4 |
|
ObjectStateService::createObjectStateGroup
takes as argument an ObjectStateGroupCreateStruct
,
in which you need to specify the identifier, default language and at least one name for the group.
To create an Object state inside a group,
use ObjectStateService::newObjectStateCreateStruct
and provide it with an ObjectStateCreateStruct
:
1 2 3 4 |
|
Assigning Object state¶
To assign an Object state to a Content item,
use ObjectStateService::setContentState
.
Provide it with a ContentInfo
object of the Content item, the Object state group and the Object state:
1 2 3 4 5 |
|
Workflow¶
Getting workflow information¶
To get information about a specific workflow for a Content item, use WorkflowServiceInterface::loadWorkflowMetadataForContent
:
1 2 3 4 |
|
Tip
marking
, a term from Symfony Workflow,
refers to a state in a workflow.
To get a list of all workflows that can be used for a given Content item, use WorkflowRegistry
:
1 |
|
Applying workflow transitions¶
To place a Content item in a workflow, use WorkflowService::start
:
1 |
|
To apply a transition to a Content item, use Workflow::apply
.
Additionally, you can check if the transition is possible for the given object using WorkflowService::can
:
1 2 3 4 |
|
Tip
\EzSystems\EzPlatformWorkflow\Value\WorkflowMetadata
object contains all
information about a workflow, such as ID, name, transitions and current stage.
\EzSystems\EzPlatformWorkflow\Value\WorkflowMetadata::$workflow
gives you direct
access to native Symfony Workflow object.
Bookmarks¶
BookmarkService
enables you to read, add and remove bookmarks from content.
To view a list of all bookmarks, use BookmarkService::loadBookmarks
:
1 2 3 4 5 6 7 |
|
You can add a bookmark to a Content item by providing its Location object
to the BookmarkService::createBookmark
method:
1 2 3 |
|
You can remove a bookmark from a Location with BookmarkService::deleteBookmark
:
1 |
|
Languages¶
Getting language information¶
To get a list of all languages in the system use LanguageService::loadLanguages
:
1 2 3 4 5 |
|
Creating a language¶
To create a new language, you need to create a LanguageCreateStruct
and provide it with the language code and language name.
Then, use LanguageService::createLanguage
and pass the LanguageCreateStruct
to it:
1 2 3 4 |
|