NAME

Statocles::Link::Tree - A link object with child links, making a tree

VERSION

version 0.098

SYNOPSIS

    my $link = Statocles::Link::Tree->new(
        href => '/',
        text => 'Home',
        children => [
            {
                href => '/blog',
                text => 'Blog',
            },
            {
                href => '/projects',
                text => 'Projects',
            },
        ],
    );

DESCRIPTION

This class represents a link which is allowed to have child links. This allows making trees of links for multi-level menus.

ATTRIBUTES

children

    $link->children([
        # Object
        Statocles::Link::Tree->new(
            href => '/blog',
            text => 'Blog',
        ),

        # Hashref of attributes
        {
            href => '/about',
            text => 'About',
        },

        # URL only
        'http://example.com',
    ]);

The children of this link. Should be an arrayref of Statocles::Link::Tree objects, hashrefs of attributes for Statocles::Link::Tree objects, or URLs which will be used as the href attribute for a Statocles::Link::Tree object.

SEE ALSO

Statocles::Link

AUTHOR

Doug Bell <preaction@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Doug Bell.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.