Changing classes and content
This page is for developers and site builders who want their own site package to install other content classes or other demo content than the package they forked. It shows where these live, how to change them, and what to keep stable so the installer script still finds what it expects.
7x and the Exponential Foundation strongly encourage you to share the finished package by pull request to se7enxweb/exponential.packages.exponential.earth: see Contribute your site package.
Contents
- Where classes and content live
- How the files are listed
- Way 1: edit the files
- Way 2: build on a test site and export
- Keep remote IDs stable
- What is not in the packages
- Before you rebuild
Where classes and content live
A site package itself carries no classes and no content. It requires packages that do:
| Package (7x) | Type | Holds |
|---|---|---|
sevenx_classes | contentclass | ezcontentclass/class-<identifier>.xml, one file per class (33 files in the source repository) |
sevenx_multisite_democontent | contentobject | its own classes in ezcontentclass/, the objects in ezcontentobject/ (contentobjects.xml plus one object-*.xml per object), binary files in simplefiles/ |
sevenx_multisite_democontent_clean | contentobject | the content of the variants without demo articles |
A fork usually keeps the classes package and replaces the content package, as cjw_multisite does with
cjw_multisite_democontent. See The demo content packages and
sevenx_classes.
How the files are listed
Nothing in a package is installed because it is in the folder; only the install items of package.xml are:
<install>
<item type="ezcontentclass" filename="class-article" sub-directory="ezcontentclass"/>
<item type="ezcontentclass" filename="class-folder" sub-directory="ezcontentclass"/>
<item type="ezcontentobject" filename="contentobjects" sub-directory="ezcontentobject"/>
</install>type selects the handler (package.ini [PackageSettings] HandlerAlias[], for example ezcontentclass =
eZContentClassPackageHandler), filename is the file without .xml, sub-directory the folder. A class file you
add needs its own <item>; a class file you remove needs its <item> removed. See
Install items and handlers.
Way 1: edit the files
Good for small changes: a class name, an attribute's description, a text in one object.
cd packages/acme_classes/ezcontentclass
xmllint --noout class-article.xml # well formed after your editA class file holds the identifier, the serialized names per language, the remote ID, the attributes with their
datatype and settings, and a <remote> block describing where it was exported from. Keep the structure the kernel
wrote; change values, not element names.
Way 2: build on a test site and export
Good for new classes, new attributes and new content: model it in the administration of a test installation (one installed from your current package), then export it and copy the files into your source repository.
# classes by identifier, comma separated
php ezpm.php create acme_classes_export 'Classes export' 1.0.0 install
php ezpm.php add acme_classes_export ezcontentclass article,folder
php ezpm.php export acme_classes_export -d var/tmp
a content subtree, without its classes
php ezpm.php create acme_content_export 'Content export' 1.0.0 install
php ezpm.php add acme_content_export ezcontentobject /content/demo --exclude-classes
php ezpm.php export acme_content_export -d var/tmpThe same exports are on Setup > Packages > Create new package (Content class export, Content object export):
Creating packages with the wizard. Then unpack the archive and copy the
class or object files, and the <item> lines of its package.xml, into your package folder:
mkdir -p var/tmp/unpacked && tar -xzf var/tmp/acme_classes_export-*.ezpkg -C var/tmp/unpackedezpm export names the archive <name>-<version>-<release>.ezpkg (eZPackage::exportName()); see
Creating packages with ezpm for the options.
Tip
Before you install a changed content package anywhere, php ezpm.php check <package> lists what the install would
meet on that installation, by remote ID, and writes nothing.
Keep remote IDs stable
Packages find things by remote ID. The class handler looks for an existing class with eZContentClass::fetchByRemoteID()
and asks what to do when it exists; the content install sorts objects into new, existing and conflicting by remote ID
(Look inside a package, compare it with your site). The 7x
installer relies on fixed remote IDs as well: mainSiteaccessHomeRemoteID() returns "the remote id of the main site's
home node, as shipped by the demo content package".
So:
- Do not change the remote ID of an object or class the installer script refers to; search the installer for the ID before you touch it.
- Give new objects and classes new remote IDs (exporting from a test site does this for you).
- A fork that installs next to the 7x content should not reuse 7x remote IDs for different things.
What is not in the packages
| Data | Where it comes from |
|---|---|
Layouts, zones, blocks and layout rules (explayouts_* tables) | extension/sevenx_themes_media/share/db_data.dba and extension/explayouts/share/, loaded by the installer (Layouts data and share .dba files) |
| Tags and star ratings of the demo content | sevenx_themes_media's share/db_data.dba, by the same step |
| Settings, siteaccesses, roles | the installer script (Changing the installer script) |
A demo page that shows its blocks on the 7x site needs its layout in that extension data as well; changing only the content package leaves the page without them.
Before you rebuild
- To do: Every new class or object file has its
<item>, every removed one lost it. - To do:
xmllint --nooutpasses for every changed XML file. - To do: No editor backups or other leftovers in the folders:
build.shpacks every file except the names it excludes (Rebuilding with build.sh). - To do: Remote IDs the installer uses are unchanged.
- To do: The package's version and changelog are raised (Versioning your own packages).
Related pages
- Making your own site package
- Contribute your site package
- Install items and handlers
- Bundling content class packages
- Content classes for websites
- Site packages: start here
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.