## content_type

Content Repository : content_type

- Overview
- Related Objects
- API

### Overview

This package is used to manipulate content types and attributes Content types represent the different kind of content displayed on a website. All content items should subclass a content type.

### Related Objects

See also: {Content Item }

### API

- Function: content_type.create_attribute

  Create a new attribute for the specified type. Automatically create the column for the attribute if the column does not already exist.

  Author: | Karl Goldstein
  Returns: | The id of the newly created attribute
  Parameters:

  > content_type: |  | The name of the type to alter
  > attribute_name: |  | The name of the attribute to create
  > pretty_name: |  | Pretty name for the new attribute, singular
  > pretty_plural: |  | Pretty name for the new attribute, plural
  > default_value: |  | The default value for the attribute, defaults to null

  Declaration:

      function create_attribute (
        content_type		in acs_attributes.object_type%TYPE,
        attribute_name	in acs_attributes.attribute_name%TYPE,
        datatype		in acs_attributes.datatype%TYPE,
        pretty_name		in acs_attributes.pretty_name%TYPE,
        pretty_plural	in acs_attributes.pretty_plural%TYPE default null,
        default_value	in acs_attributes.default_value%TYPE default null,
        column_spec           in varchar2  default 'varchar2(4000)'
      ) return acs_attributes.attribute_id%TYPE;

  See Also: | acs_object_type.create_attribute, content_type.create_type

- Function: content_type.get_template

  Retrieve the appropriate template for rendering items of the specified type.

  Author: | Karl Goldstein
  Returns: | The ID of the template to use
  Parameters:

  > content_type: |  | The type for which the template is to be retrieved
  > use_context: |  | The context in which the template is appropriate, such as 'admin' or 'public'

  Declaration:

      function get_template (
        content_type  in cr_type_template_map.content_type%TYPE,
        use_context   in cr_type_template_map.use_context%TYPE
      ) return cr_templates.template_id%TYPE;

  See Also: | content_item.register_template, content_item.unregister_template, content_item.get_template, content_type.unregister_template, content_type.register_template, content_type.set_default_template

- Function: content_type.is_content_type

  Parameters:
  Not yet documented
  Declaration:

      function is_content_type (
        object_type   in acs_object_types.object_type%TYPE
      ) return char;

- Procedure: content_type.create_type

  Create a new content type. Automatically create the attribute table for the type if the table does not already exist.

  Author: | Karl Goldstein
  Parameters:

  > content_type: |  | The name of the new type
  > supertype: |  | The supertype, defaults to content_revision
  > pretty_name: |  | Pretty name for the type, singular
  > pretty_plural: |  | Pretty name for the type, plural
  > table_name: |  | The name for the attribute table, defaults to the name of the supertype
  > id_column: |  | The primary key for the table, defaults to 'XXX'
  > name_method: |  | As in `acs_object_type.create_type`

  Declaration:

      procedure create_type (
        content_type		in acs_object_types.object_type%TYPE,
        supertype		in acs_object_types.object_type%TYPE
                                 default 'content_revision',
        pretty_name		in acs_object_types.pretty_name%TYPE,
        pretty_plural	        in acs_object_types.pretty_plural%TYPE,
        table_name		in acs_object_types.table_name%TYPE default null,
        id_column		in acs_object_types.id_column%TYPE default 'XXX',
        name_method           in acs_object_types.name_method%TYPE default null
      );

  See Also: | acs_object_type.create_type

- Procedure: content_type.drop_attribute

  Drop an existing attribute. If you are using CMS, make sure to call `cm_form_widget.unregister_attribute_widget` before calling this function.

  Author: | Karl Goldstein
  Parameters:

  > content_type: |  | The name of the type to alter
  > attribute_name: |  | The name of the attribute to drop
  > drop_column: |  | If 't', will also alter the table and remove the column where the attribute is stored. The default is 'f' (leaves the table untouched).

  Declaration:

      procedure drop_attribute (
        content_type		in acs_attributes.object_type%TYPE,
        attribute_name	in acs_attributes.attribute_name%TYPE,
        drop_column           in varchar2 default 'f'
      );

  See Also: | acs_object.drop_attribute, content_type.create_attribute, cm_form_widget.unregister_attribute_widget

- Procedure: content_type.refresh_view

  Create a view for the type which joins all attributes of the type, including the inherited attributes. The view is named "

  X" Called by create_attribute and create_type.

  Author: | Karl Goldstein
  Parameters:

  > content_type: |  | The type for which the view is to be created.

  Declaration:

      procedure refresh_view (
        content_type  in cr_type_template_map.content_type%TYPE
      );

  See Also: | content_type.create_type

- Procedure: content_type.register_child_type

  Register a parent-child relationship between a content type and another object type. This may then be used by the content_item.is_valid_relation function to validate the relationship between an item and a potential child.

  Author: | Karl Goldstein
  Parameters:

  > content_type: |  | The type of the item from which the relationship originated.
  > child_type: |  | The type of the child item.
  > relation_tag: |  | A simple token used to identify a set of relations.
  > min_n: |  | The minimun number of parent-child relationships of this type which an item must have to go live.
  > max_n: |  | The minimun number of relationships of this type which an item must have to go live.

  Declaration:

      procedure register_child_type (
        parent_type  in cr_type_children.parent_type%TYPE,
        child_type    in cr_type_children.child_type%TYPE,
        relation_tag  in cr_type_children.relation_tag%TYPE default 'generic',
        min_n         in integer default 0,
        max_n         in integer default null
      );

  See Also: | content_type.register_relation_type, content_type.register_child_type

- Procedure: content_type.register_mime_type

  Parameters:
  Not yet documented
  Declaration:

      procedure register_mime_type (
        content_type  in cr_content_mime_type_map.content_type%TYPE,
        mime_type	in cr_content_mime_type_map.mime_type%TYPE
      );

- Procedure: content_type.register_relation_type

  Register a relationship between a content type and another object type. This may then be used by the content_item.is_valid_relation function to validate any relationship between an item and another object.

  Author: | Karl Goldstein
  Parameters:

  > content_type: |  | The type of the item from which the relationship originated.
  > target_type: |  | The type of the item to which the relationship is targeted.
  > relation_tag: |  | A simple token used to identify a set of relations.
  > min_n: |  | The minimun number of relationships of this type which an item must have to go live.
  > max_n: |  | The minimun number of relationships of this type which an item must have to go live.

  Declaration:

      procedure register_relation_type (
        content_type  in cr_type_relations.content_type%TYPE,
        target_type   in cr_type_relations.target_type%TYPE,
        relation_tag  in cr_type_relations.relation_tag%TYPE default 'generic',
        min_n         in integer default 0,
        max_n         in integer default null
      );

  See Also: | content_type.unregister_relation_type

- Procedure: content_type.register_template

  Register a template for the content type. This template may be used to render all items of that type.

  Author: | Karl Goldstein
  Parameters:

  > content_type: |  | The type for which the template is to be registered
  > template_id: |  | The ID of the template to register
  > use_context: |  | The context in which the template is appropriate, such as 'admin' or 'public'
  > is_default: |  | If 't', this template becomes the default template for the type, default is 'f'.

  Declaration:

      procedure register_template (
        content_type  in cr_type_template_map.content_type%TYPE,
        template_id   in cr_templates.template_id%TYPE,
        use_context   in cr_type_template_map.use_context%TYPE,
        is_default    in cr_type_template_map.is_default%TYPE default 'f'
      );

  See Also: | content_item.register_template, content_item.unregister_template, content_item.get_template, content_type.unregister_template, content_type.set_default_template, content_type.get_template

- Procedure: content_type.set_default_template

  Make the registered template a default template. The default template will be used to render all items of the type for which no individual template is registered.

  Author: | Karl Goldstein
  Parameters:

  > content_type: |  | The type for which the template is to be made default
  > template_id: |  | The ID of the template to make default
  > use_context: |  | The context in which the template is appropriate, such as 'admin' or 'public'

  Declaration:

      procedure set_default_template (
        content_type  in cr_type_template_map.content_type%TYPE,
        template_id   in cr_templates.template_id%TYPE,
        use_context   in cr_type_template_map.use_context%TYPE
      );

  See Also: | content_item.register_template, content_item.unregister_template, content_item.get_template, content_type.unregister_template, content_type.register_template, content_type.get_template

- Procedure: content_type.unregister_child_type

  Register a parent-child relationship between a content type and another object type. This may then be used by the content_item.is_valid_relation function to validate the relationship between an item and a potential child.

  Author: | Karl Goldstein
  Parameters:

  > parent_type: |  | The type of the parent item.
  > child_type: |  | The type of the child item.
  > relation_tag: |  | A simple token used to identify a set of relations.

  Declaration:

      procedure unregister_child_type (
        parent_type  in cr_type_children.parent_type%TYPE,
        child_type   in cr_type_children.child_type%TYPE,
        relation_tag in cr_type_children.relation_tag%TYPE default null
      );

  See Also: | content_type.register_relation_type, content_type.register_child_type

- Procedure: content_type.unregister_mime_type

  Parameters:
  Not yet documented
  Declaration:

      procedure unregister_mime_type (
        content_type  in cr_content_mime_type_map.content_type%TYPE,
        mime_type	in cr_content_mime_type_map.mime_type%TYPE
      );

- Procedure: content_type.unregister_relation_type

  Unregister a relationship between a content type and another object type.

  Author: | Karl Goldstein
  Parameters:

  > content_type: |  | The type of the item from which the relationship originated.
  > target_type: |  | The type of the item to which the relationship is targeted.
  > relation_tag: |  | A simple token used to identify a set of relations.

  Declaration:

      procedure unregister_relation_type (
        content_type in cr_type_relations.content_type%TYPE,
        target_type  in cr_type_relations.target_type%TYPE,
        relation_tag in cr_type_relations.relation_tag%TYPE default null
      );

  See Also: | content_type.register_relation_type

- Procedure: content_type.unregister_template

  Unregister a template. If the unregistered template was the default template, the content_type can no longer be rendered in the use_context,

  Author: | Karl Goldstein
  Parameters:

  > content_type: |  | The type for which the template is to be unregistered
  > template_id: |  | The ID of the template to unregister
  > use_context: |  | The context in which the template is to be unregistered

  Declaration:

      procedure unregister_template (
        content_type  in cr_type_template_map.content_type%TYPE default null,
        template_id   in cr_templates.template_id%TYPE,
        use_context   in cr_type_template_map.use_context%TYPE default null
      );

  See Also: | content_item.register_template, content_item.unregister_template, content_item.get_template, content_type.set_default_template, content_type.register_template, content_type.get_template

  Last Modified: $Id: type.html,v 1.1.1.1 2001/03/13 22:59:26 ben Exp $