- lfc.utils.registration.register_content_type(klass, name, sub_types=[], templates=[], default_template=None, global_addable=True, workflow=None)¶
Registers a content type.
Parameters:
- klass
- The klass which should be registered as content type. Must be a sub class of BaseContent.
- name
- The unique name under which the content type should be registered.
- sub_types
- Content types which are allowed to be added as children to the registered object. Must be a list of strings with valid names of content types.
- templates
- Templates which are allowed to be selected for the registered object. Must be a list of strings with valid template names.
- default_template
- Default template of the registered object.
- global_addable
- Decides whether the content type is global addable or just within specific content types.
- Workflow
- The workflow of the content type. Needs to be a string with the unique workflow name.
- lfc.utils.registration.register_template(name, path, children_columns=0, images_columns=0)¶
Registers a template.
Parameters:
- name
- The name of the template.
- path
- The path to the template file.
- children_columns
- The amount of columns for sub pages. This can be used within templates to structure children.
- images_columns
- The amount of columns for images. This can be used within templates to structure images.
- lfc.utils.registration.register_sub_type(klass, name)¶
Registers a content type as a allowed sub type to another content type.
Parameters:
- klass
- The class which should be registered.
- name
- The name of the content type to which the passed content type (klass) should be registered.
- lfc.utils.registration.get_info(obj_or_type)¶
Returns the ContentTypeRegistration for the passed object or type. Returns None if the content type registry is not found.
Parameters:
- obj_or_type
- The object or type for which the information should be returned. Must be an instance of BaseContent or a String with a valid type name.
- lfc.utils.registration.get_allowed_subtypes(obj_or_type=None)¶
Returns all allowed sub types for given object or type. Returns a list of ContentTypeRegistrations.
Parameters:
- obj_or_type
- Must be an instance of BaseContent, a string with a valid type name or None. If it’s None the conten type registrations of all global addable content types are returned.
- lfc.utils.registration.get_default_template(obj_or_type)¶
Returns the default template for given object or type. Returns an instance of Template.
Parameters:
- obj_or_type
- The object or type for which the temlate should be returned. Must be an instance of BaseContent or a String with a valid type name.
Stores all registration relevant information of a registered content type.
Attributes: