Develop Custom Section Layouts with APIs
You can develop custom section layouts in Oracle Content Management with the Section Layout API, which includes Rendering APIs and Editing APIs.
For starter files to look at, see Create a Section Layout. The starter files for section layouts include comments with details about the structure of section-layout files.
Rendering APIs
The Rendering APIs, loaded from the render.mjs
module, are used in
Site Builder and at runtime.
Rendering API | Description | Input Parameter(s) | Return Result |
---|---|---|---|
(Constructor) | Initializes the Section Layout rendering module. |
A JavaScript object that contains the following properties:
|
The Section Layout Rendering APIs are initialized. |
render |
Emits DOM elements appropriate for the section layout to the page, including container DIVs for child components. |
container (Element) : The DOM element into which the section layout’s markup should be rendered. |
After this method returns, child components will be rendered. You can identify child components by finding child |
addComponent |
Used with content list components to dynamically add child components to a section layout. This function is optional. |
container (Element): The DOM element into which the new component should be rendered. componentId (String): The ID of the new component to add to the section layout. |
After this method returns, the element whose ID matches the |
Editing APIs
The edit.mjs
module is loaded if the
hasEditHandlers
property is set to true
in the
appinfo.json
file associated with the section layout.
The Editing APIs are used in Site Builder.
All of the functions in this module except the Constructor are optional.
Editing API | Description | Input Parameter(s) | Return Result |
---|---|---|---|
(Constructor) | Initializes the Section Layout editing module. |
A JavaScript object that contains the following property:
|
The Section Layout Editing APIs are initialized. |
getCapabilities |
Returns an object describing the editing capabilities of the section layout. |
A JavaScript object that describes the editing capabilities of the section layout. Upon input, the default capabilities will be provided to the function. The function can modify the Capabilities object as needed. The Capabilities object can include the following capabilities:
|
(Object): The capabilities for the section layout. |
getCaptionContent |
Returns the section layout display name, which will appear in UI elements. |
None. |
(String): The display name of the section layout. |
filterCapabilities |
Allows the section layout to modify the Capabilities object before menus are displayed to the user. You can use this API to adjust or remove menu options. (See also getCapabilities.) |
A JavaScript object that describes the editing capabilities of the section layout. On input, the default capabilities will be provided to the function. |
(Object) The capabilities for the section layout. |
onDragOver | Called during a Drag and Drop operation to indicate if the dragged item can be dropped on the section layout. |
eventObject (Event Object): An event object that holds information about the drag event. dataTransfer (DataTransfer Object): A |
(Boolean) A value indicating if the dragged item can be accepted by the section layout. Returns true if the section layout can accept the dragged item, false otherwise. |
onDrop | Called during the drop portion of a Drag and Drop operation to indicate that the dragged item should be placed inside the section layout. |
eventObject (Event Object) : An event object that holds information about the drop event. dataTransfer (DataTransfer Object) A DataTransfer object that holds information about the item being dropped on the section layout. |
(Boolean) A value indicating if the drop operation was handled by the section layout. Returning true bypasses the default logic. |
onAddComponent | Notifies the Section Layout that a Drag and Drop operation added an item in the section layout. |
eventObject (Event Object): An event object that holds information about the drag event. dataTransfer (DataTransfer Object): A DataTransfer object that holds information about the item being dropped on the section layout. componentId (String): The |
Section layout notification. |
onMoveComponent |
Notifies the section layout that a Drag and Drop operation moved an item in the section layout. |
eventObject (Event Object): An event object that holds information about the drag event. dataTransfer (DataTransfer Object): A DataTransfer object that holds information about the item being dropped on the section layout. componentId (String): The |
Section layout notification. |
getSettingsData |
Allows the section layout to change the Settings data before the Settings Panel is displayed. |
settingsData (Object): The default settings data computed for the Section Layout |
(Object) The settings data for the section layout. |
updateSettings |
Allows the section layout to change its settings after the Settings Panel has been closed. This API is called just before the settings are stored in the page model. |
parameters (Object): The raw parameters object returned from the Settings Panel. sectionLayoutData (Object) : The section layout data that will be stored. Default data will be generated from |
(Object) The section layout data to store in the page model. |
dispose |
Allows the editing module to free memory, detach events, and deallocate resources associated with the edit handlers. This API is called when the section layout needs to completely redraw, as in the case of an Undo/Redo operation. |
None. | Redrawing the section layout is enabled. |