Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

content_class (migration step)

Creates, updates, ensures or deletes a content class with its attributes, their datatype settings and the translations of their names.

Download as PDF

Address: https://doc.exponential.earth/learninminutes/exphelp/viewer/examples/migration-steps/content_class.md

On this page

content_class

Creates, updates, ensures or deletes a content class with its attributes, their datatype settings and the translations of their names.

A step of a YAML migration with type: content_class. The class expMigrationStepContentClass (kernel/classes/migration/steps/expmigrationstepcontentclass.php) is registered in settings/migration.ini [StepSettings] StepTypeList[content_class].

Modes

mode: is one of create, update, ensure, delete; every step names one.

Keys

KeyTypeModesDefaultWhat it is
classidentifier (class)update, deletethe class to update or delete: its identifier, id or remote:<remote id>
identifierstringcreate, update, ensurethe identifier of the class; ensure finds the class by it (update: a new identifier)
remote_idstringcreate, ensurethe remote id of a new class (default: a new one)
languagestringcreate, update, ensurethe language of name: (default: the default language of content, ContentObjectLocale)
namestringcreate, update, ensurethe name of the class in the language of language:
namesmapcreate, update, ensurelanguage => the name of the class in it: its translations
descriptionstringcreate, update, ensurethe description of the class in the language of language:
descriptionsmapcreate, update, ensurelanguage => the description of the class in it
name_patternstringcreate, update, ensurehow an object is named from its attributes (<title>; default: the first attribute)
url_alias_patternstringcreate, update, ensurehow the URL alias of an object is made (default: as its name)
containerboolcreate, update, ensurewhether objects of the class can have children
always_availableboolcreate, update, ensurewhether a new object of the class is shown in a language it does not have
sort_fieldstring: path, published, modified, section, depth, class_identifier, class_name, priority, namecreate, update, ensurehow the children of a new object are sorted
sort_orderstring: asc, desccreate, update, ensureasc or desc
groupslistcreate, update, ensurethe class groups the class is in: names or ids (create, ensure: default Content; update and ensure add the class to those it is not in)
attributeslistcreate, ensurethe attributes, each a map: identifier, type (the datatype), name, names, description, descriptions, required, searchable, translatable, information_collector, category, placement, settings; ensure adds the missing ones and changes what differs
add_attributeslistupdateattributes to add, as in attributes:; every object of the class gets them
update_attributesmapupdateattribute identifier => what changes (the keys of attributes: but identifier and type)
remove_attributeslistupdatethe identifiers of attributes to remove, with their data in every object
with_objectsbooldeletefalsetrue: a class with objects is deleted with them; false (the default): it is not deleted
missingstring: fail, skipupdate, delete"fail"what happens when the class is not there: fail (the default) or skip

Besides these, every step takes the keys of the engine: type, mode, if, references, environments, engines and comment (the file format). A key of type identifier names a node, an object or another part of the installation by id, remote id, path or name (identifiers).

Values for references

references: { <name>: <value> } keeps a value of the step's result as ${ref.<name>} for the steps and migrations after it:

ValueWhat it is
class_idthe id of the class
identifierits identifier
remote_idits remote id
nameits name
createdtrue when the step created the class
changedtrue when the step changed it (created, updated or deleted)

Undoing

Some steps of this type undo themselves when their migration is rolled back without down: (the class says which); a migration with any other step of it needs down: or a rollback to its caption.

Caches it touches (cleared after the run): classid, content, sortkey.

Example

- type: content_class
  mode: ensure
  identifier: news_article
  name: News article
  names: { ger-DE: Nachrichtenartikel }
  name_pattern: "<title>"
  groups: [ Content ]
  attributes:
    - { identifier: title, type: ezstring, name: Title, names: { ger-DE: Titel }, required: true, searchable: true, settings: { data_int1: 255 } }
    - { identifier: body, type: ezxmltext, name: Body }
  references: { news_class: class_id }

Generated by ./console exp:help:examples from settings/migration.ini, kernel/classes/migration/steps/expmigrationstepcontentclass.php. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x