Bric::Biz::ElementType

Name

Bric::Biz::ElementType - Bricolage element types

Synopsis

# Create new types of elements.
$element = Bric::Biz::ElementType->new($init)
$element = Bric::Biz::ElementType->lookup({id => $id})
($at_list || @ats) = Bric::Biz::ElementType->list($param)
($id_list || @ids) = Bric::Biz::ElementType->list_ids($param)

# Return the ID of this object.
$id = $element->get_id()

# Get/set this element type's name.
$element = $element->set_name( $name )
$name       = $element->get_name()

# Get/set the description for this element type
$element  = $element->set_description($description)
$description = $element->get_description()

# Get/set the primary output channel ID for this element type.
$element = $element->set_primary_oc_id($oc_id, $site_id);
$oc_id = $element->get_primary_oc_id($site_id);

# Attribute methods.
$val  = $element->set_attr($name, $value);
$val  = $element->get_attr($name);
\%val = $element->all_attr;

# Attribute metadata methods.
$val = $element->set_meta($name, $meta, $value);
$val = $element->get_meta($name, $meta);

# Manage output channels.
$element        = $element->add_output_channels([$output_channel])
($oc_list || @ocs) = $element->get_output_channels()
$element        = $element->delete_output_channels([$output_channel])

# Manage sites
$element               = $element->add_sites([$site])
($site_list || @sites) = $element->get_sites()
$element               = $element->remove_sites([$site])

# Manage the parts of an element type.
$element            = $element->add_field_types($field);
$field_type         = $element->new_field_type($param);
$element            = $element->copy_field_type($at, $field);
($part_list || @parts) = $element->get_field_types($field);
$element            = $element->del_field_types($field);

# Add, retrieve and delete containers from this element type.
$element            = $element->add_containers($at || [$at]);
(@at_list || $at_list) = $element->get_containers();
$element            = $element->del_containers($at || [$at]);

# Get/set the active flag.
$element  = $element->activate()
$element  = $element->deactivate()
(undef || 1) = $element->is_active()

# Save this element type.
$element = $element->save()

Description

The element type class registers new type of elements that define the structures of story and media documents. Element type objects are composed of subelement types and fields, and top-level (story and media type) element types are associated with sites and output channels to define how documents based on them will be output and in what sites they can be created.

Interface

Constructors

Destructors

Public Class Methods

Accessors

id

my $id = $element_type->get_id;

Returns the element type object's unique database ID.

name

my $name = $element_type->get_name;
$element_type = $element_type->set_name($name);

Get and set the element type object's unique name.

description

my $description = $element_type->get_description;
$element_type = $element_type->set_description($description);

Get and set the element type object's description. The setter converts non-Unix line endings.

key_name

my $key_name = $element_type->get_key_name;
$element_type = $element_type->set_key_name($key_name);

Get and set the element type object's unique key name.

top_level

my $is_top_level = $element_type->is_top_level;
$element_type = $element_type->set_top_level($is_top_level);

The top_level attribute is a boolean that indicates whether the element type is a story type or a media type, and therefore a top-level element. In other words, elements based on it cannot be subelements of any other elements.

biz_type_id

my $biz_type_id = $element_type->get_biz_type_id;
$element_type = $element_type->set_biz_type_id($biz_type_id);

The biz_type_id attribute is contains the ID for a Bric::Util::Class|Bric::Util::Class indicating the class of object with whic the elements based on the type can be associated. The values allowed are only those for Bric::Biz::Asset::Business::Story, Bric::Biz::Asset::Business::Media, and the latter's subclasses.

paginated

my $is_paginated = $element_type->is_paginated;
$element_type = $element_type->set_paginated($is_paginated);

The paginated attribute is a boolean that indicates whether the elements based on the element type represent pages. Paginated elements generally trigger the output of multiple files, one for each paginated element in a document, by the burner. This attribute is ignored for top level elements.

fixed_uri

my $is_fixed_uri = $element_type->is_fixed_uri;
$element_type = $element_type->set_fixed_uri($is_fixed_uri);

The fixed_uri attribute is a boolean that indicates whether documents based on the element type will use the "URI Format" or "Fixed URI Format" of an output channel through which the document is published. This attribute is ignored for non-top level elements.

related_story

my $is_related_story = $element_type->is_related_story;
$element_type = $element_type->set_related_story($is_related_story);

The related_story attribute is a boolean that indicates whether elements based on the element type can have another story related to them.

my $is_related_media = $element_type->is_related_media;
$element_type = $element_type->set_related_media($is_related_media);

The related_media attribute is a boolean that indicates whether elements based on the element type can have another media related to them.

media

my $is_media = $element_type->is_media;
$element_type = $element_type->set_media($is_media);

The media attribute is a boolean that indicates whether elements based on the element type are media documents. This attribute is a redundant combination fo the biz_type_id and top_level attributes.

displayed

my $is_displayed = $element_type->is_displayed;
$element_type = $element_type->set_displayed($is_displayed);

The displayed attribute is a boolean that indicates whether elements based on the element type are displayed in the document profile when they are first created. Note that it's ignored for top-level elements.

biz_class_id

my $biz_class_id   = $element_type->get_biz_class_id;
my $biz_class_name = $element_type->get_biz_class;
$element_type->set_biz_class_id($biz_class_id);

Get and set the ID of the Bric::Util::Class object that represents the class for which elements of this type can be created. Must be the ID for either Bric::Biz::Asset::Business::Story, Bric::Biz::Asset::Business::Media, or one of its subclasses. get_biz_class() actually returns the package name of the business class represented by the biz_class_id attribute.

primary_oc_id

my $primary_oc_id = $element_type->get_primary_oc_id($site_id);
   $primary_oc_id = $element_type->get_primary_oc_id($site);

$element_type->set_primary_oc_id($primary_oc_id, $site_id);
$element_type->set_primary_oc_id($primary_oc_id, $site);

Gets and sets the primary output channel within the given site for the element type. Either a site object or ID can be used. Only top-level element types have site and output channel associations.

Throws:

Side Effects: NONE.

Notes: NONE.

active

my $is_active = $element_type->is_active;
$element_type->activate;
$element_type->deactivate;

This boolean attribute indicates whether the element type is active.

Instance Methods

Output Channels

Sites

Field Types

Containers

save

$element_type->save;

Saves changes to the element type, including its subelement element type and field type associatesions, to the database.

Arbitrary Attribute Management

$val = $element_type->set_attr($name => $value);
$val = $element_type->get_attr($name);
$val = $element_type->del_attr($name);

Get/Set/Delete attributes on this element type.

Arbitrary Attribute Metadata Management

$val = $element_type->set_meta($name, $field => $value);
$val = $element_type->get_meta($name => $field);
$val = $element_type->get_meta($name);

Get/Set attribute metadata on this element type. Calling the get_meta() method without $field returns all metadata names and values as a hash.

Private

Private Class Methods

Private Instance Methods

These need documenting.

Private Functions

Notes

NONE.

Author

Michael Soderstrom

Refactored by David Wheeler

See Also

Bric::Biz::Element, Bric::Util::Coll::OCElement.