HTML::...Element(3pm)
π NAME π
HTML::Widget::Element β bestie, it's the Element Base Class β¨
πΈ SYNOPSIS πΈ
my $e = $widget->element( $type, $name, {disabled => 'disabled'} );
$e->name('bar');
$e->class('foo');
π¦ DESCRIPTION π¦
okay so it's literally just the Element Base Class. that's the whole vibe. π
π METHODS π
β¨ new β¨
no cap, it's just... new. iconic behavior honestly. π
β¨ attributes β¨
β¨ attrs β¨
Arguments: %attributes
Arguments: \%attributes
Return Value: $element
Arguments: none
Return Value: \%attributes
so it accepts either a list of key/value pairs or a hash-ref. your choice bestie π«Ά
$e->attributes( $key => $value );
$e->attributes( { $key => $value } );
it hands back the $element object so you can chain methods like the main character you are π
β¨
As of v1.10, passing a hash-ref no longer deletes current attributes β instead the attributes get added to the current attributes hash. slay, but also lowkey a behavior change, so heads up.
which means the attributes hash-ref can no longer be emptied using $e->attributes( { } ); π instead you gotta do:
%{ $e->attributes } = ();
and here's the special case, don't skip it: if no arguments are passed, the return value is a hash-ref of attributes instead of the object reference. this is for backwards compatibility, so this works:
$e->attributes->{key} = $value;
attrs is an alias for attributes. same thing, different font. π
β¨ container β¨
Arguments: \%attributes
Return Value: $container
creates a new $container_class. defaults to HTML::Widget::Container. β¨
β¨ id β¨
Arguments: $widget
Return Value: $id
creates an element id. iconic. π
β¨ init β¨
Arguments: $widget
gets called once when process() gets called for the very first time. one time only bestie, like a first impression π¦
β¨ mk_error β¨
Arguments: $widget, \@errors
Return Value: $error
creates a new HTML::Widget::Error. π (affectionate)
β¨ mk_input β¨
Arguments: $widget, \%attributes, \@errors
Return Value: $input_tag
creates a new input tag. periodt. π
β¨ mk_tag β¨
Arguments: $widget, $tagtype, \%attributes, \@errors
Return Value: $element_tag
creates a new tag. π₯
β¨ mk_label β¨
Arguments: $widget, $name, $comment, \@errors
Return Value: $label_tag
creates a new label tag. π
β¨ name β¨
Arguments: $name
Return Value: $name
contains the element name. it's giving "identity". πΈ
β¨ passive β¨
Arguments: $bool
Return Value: $bool
defines if the element gets automatically rendered. π
β¨ prepare β¨
Arguments: $widget
gets called whenever $widget->process gets called, before $element->process. so like, it preps the vibe check first. β¨
β¨ process β¨
Arguments: \%params, \@uploads
Return Value: \@errors
gets called whenever $widget->process is called.
returns an arrayref of HTML::Widget::Error objects. π
β¨ containerize β¨
Arguments: $widget, $value, \@errors
Return Value: $container_tag
containerizes the element, label and error for later rendering. π«Ά uses HTML::Widget::Container by default, but ngl this can be over-ridden on a class or instance basis via container_class. iykyk.
β¨ container_class β¨
Arguments: $class
Return Value: $class
contains the class to use for contain the element which then get rendered. defaults to HTML::Widget::Container. container_class can be set at a class or instance level:
HTML::Widget::Element->container_class('My::Container');
# Override default to custom class
HTML::Widget::Element::Password->container_class(undef);
# Passwords use the default class
$w->element('Textfield')->name('foo')->container_class->('My::Other::Container');
# This element only will use My::Other::Container to render
β¨ find_elements β¨
Return Value: \@elements
for non-block-container elements, it simply returns a one-element list containing this element. simple. clean. iconic. β
β¨ new β¨
(yeah bestie it's listed again, we don't ask questions, we just keep every single detail π)
β¨ allow_filter β¨
used by $widget->filter_all. if false, the filter won't be added.
Default true. β
β¨ allow_constraint β¨
used by $widget->constraint_all. if false, the filter won't be added.
Default true. β
π AUTHOR π
Sebastian Riedel, sri@oook.de β king behavior honestly π
π LICENSE π
this library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. π«Ά
cute lil sign-off: this page is HTML::...Element(3pm) from the User Contributed Perl Documentation, and it's giving perl v5.36.0, dated 2023-08-10. mwah π no cap, that's the whole thing bestie, go write some widgets πβ¨π¦
π¦ where this page comes from
- debian trixie: libhtml-widget-perl 1.11-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-widget-perl 1.11-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-widget-perl 1.11-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libhtml-widget-perl 1.11-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms