<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package FixMyStreet::App::Form::Widget::Field::CheckboxGroup;

use Moose::Role;
with 'HTML::FormHandler::Widget::Field::CheckboxGroup';
use namespace::autoclean;

has ul_class =&gt; ( is =&gt; 'ro' );

sub render_element {
    my ( $self, $result ) = @_;
    $result ||= $self-&gt;result;

    my $output = '&lt;ul class="' . ($self-&gt;ul_class || '') . '"&gt;';
    foreach my $option ( @{ $self-&gt;{options} } ) {
        if ( my $label = $option-&gt;{group} ) {
            $label = $self-&gt;_localize( $label ) if $self-&gt;localize_labels;
            $output .= qq{\n&lt;li&gt;$label\n&lt;ul class="no-margin no-bullets"&gt;};
            $output .= qq{\n&lt;li&gt;(&lt;a href="#" data-select-all&gt;} . _('all') . '&lt;/a&gt; / ';
            $output .= '&lt;a href="#" data-select-none&gt;' . _('none') . '&lt;/a&gt;)&lt;/li&gt;';
            foreach my $group_opt ( @{ $option-&gt;{options} } ) {
                $output .= '&lt;li&gt;';
                $output .= $self-&gt;render_option( $group_opt, $result );
                $output .= "&lt;/li&gt;\n";
            }
            $output .= qq{&lt;/ul&gt;\n&lt;/li&gt;};
        }
        else {
            $output .= '&lt;li&gt;' . $self-&gt;render_option( $option, $result ) . '&lt;/li&gt;';
        }
    }
    $output .= '&lt;/ul&gt;';
    $self-&gt;reset_options_index;
    return $output;
}

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

FixMyStreet::App::Form::Widget::Field::CheckboxGroup - checkbox group field role

=head1 SYNOPSIS

Subclass of HTML::FormHandler::Widget::Field::CheckboxGroup, but printed
as a nested &lt;ul&gt;.

=head1 AUTHOR

FormHandler Contributors - see HTML::FormHandler

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Gerda Shank.

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

=cut
</pre></body></html>