Override a Core Content Type
A number of content types are included with the Widget Framework (Story
and Picture
, for example). These core content types are designed both to work well with the Widget Framework and to provide a flexible "starter pack" of content types that will support a wide range of publication types. Although the core content types satisfy most standard requirements, you may nevertheless feel the need to modify or extend one or more of them in some way.
Should you need modify a core content type, it is actually quite simple to do so. What you actually do is to override the content type within a specific publication: you copy the content type definition from the Widget Framework distribution into your publication's content-type
resource, make the changes you require and then build and upload your publication to the Content Engine in the usual way. During the build process, the content type definitions are merged in such a way that your modified version overrides the standard version supplied with the Widget Framework.
The following procedure describes how to change a content type definition for the demo publication supplied with the Widget Framework. The process is, however, exactly the same for any other publication.
-
Unzip the Widget Framework distribution file
widget-framework-core-3.5.1.174428.zip
somewhere on you computer. -
In the
misc/widgets/widget-framework-core/src/main/webapp/META-INF/escenic/publication-resources/escenic/
of the unzipped folder tree you will find acontent-type
resource file. Open this file in an editor. -
Find the content type definition you want to change (let's say the
story
content type). -
Copy the content type definition.
-
In the
misc/demo/src/main/webapp/META-INF/escenic/publication-resources/escenic
folder of the unzipped folder tree you will find anothercontent-type
resource file. Open this file in an editor and paste in the copied content type definition. -
Make whatever changes you require to the pasted content type definition. You might, for example, add a field to it.
-
Save your changes and close both
content-type
files. -
In the
misc/demo
folder, enter:$
mvn clean installThis will produce a publication
.war
file inmisc/demo/target
calleddemo-core-3.5.1.174428.war
. -
Use the
escenic-admin
webapp to create a publication from the.war
file you have generated or upload it to an existing publication. -
Open the publication you have created/modified in Content Studio and create a
story
content item. You should be able to see the change you have made.
Note the following points:
-
You only need to copy and modify the specific elements you want to change. Even though the
story
content type references lots of fields and field groups defined elsewhere in thecontent-type
resource, you don't have to copy them as well. The file you copy into does not need to be a completecontent-type
resource because it's just a collection of overrides that are merged with the maincontent-type
resource during the build process. -
You don't need to copy entire content type definitions either. If for example, you just want to add some constraints to a field definition, then you only need to copy the
field-group
thefield
belongs to, and modify the requiredfield
. Don't copy individualfield
elements though, since they don't have unique names and therefore cannot be merged correctly.