pkg('ListItem') -  interface to manage items within a pkg('List').


    use Krang::ClassLoader 'ListItem';
    # create and save new list item in a Krang::List 
    my $list_item = pkg('ListItem')->new(   list => $list_object,
                                            data => 'item data here'
    # will return what order in the list this item is; in this case 1
    # as it is the only item currently in the list
    my $order = $list_item->order;
    # create new list item in same list, assigning it to order 1
    # and thus moving $list_item to order 2
    my $list_item2 = pkg('ListItem')->new(  list => $list_object,
                                            order => 1,
                                            data => 'data here' );
    # find and return list items in list 
    my @found = pkg('ListItem')->find( list => $list_object );
    # create new list item, a member of another Krang::List
    # and child of another list item
    my $list_item3 = pkg('ListItem')->new(  list => $list_object2,
                                            parent_list_item => $list_item,
                                            data => 'data here' );
    # find list items that are children of a given list item
    my @found = pkg('ListItem')->find( parent_list_item_id => $list_item->list_item_id );
    # delete them both


This class handles management of data items within krang lists.




Krang::List, Krang::ListGroup, Krang::ElementClass::ListGroup, The Krang Element System