Krang::ElementClass::TopLevel - base class for top-level element classes


  package ElementSet::article;
  use Krang::ClassLoader base => 'ElementClass::TopLevel';
  # override new() to setup element class parameters
  sub new { 
      my $pkg = shift;
      my %arg = (name      => "article",
                 children  => [ 'deck', 'paragraph', 'image' ],
      return $pkg->SUPER::new(%arg); 


This class serves as the base class for top-level element classes. The root of an element tree must start with a sub-class of this class. The methods provided allow this special element to control some aspects of the Story or Category which contains it. For example, the build_url method allows element classes to determine how a story builds its URL.

Additionally, some methods make no sense for a top-level element class, and they are stubbed out with implementations that croak. For example, the input_form() method is useless for a top-level element because the UI does not allow top-level elements to recieve input.