HTML::...:Block(3pm)

πŸ“¦
version 1.11 Β· 3 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

HTML::Widget::Element::Block β€” Block Level Element, bestie. That's the whole vibe. πŸ‘‘


✨ SYNOPSIS ✨

my $e = $widget->element( 'Block', 'div' );
$e->value('bar');

πŸŽ€ DESCRIPTION πŸŽ€

Okay so this is a Block Level Element. That's it, that's the whole thing. It's the base class for HTML::Widget::Element::Fieldset, so if you're messing with fieldsets, you're already living in this house. 🏠✨


πŸ’… METHODS πŸ’…

🌸 new 🌸

Returns a new Block element. But lowkey? You usually don't need to call this yourself β€” just use $widget->element() or $block->element() to spin up a fresh Block element inside a widget or element that already exists. Let the parents handle it, fr fr. 🫢

🌈 type 🌈

Default value is div, which creates a <div> container for you. You can change it, though β€” swap it to create a tag of any type. Customisation era. πŸ’…

πŸ¦‹ element πŸ¦‹

Add a new element, nested all cute and cozy within this Block. For the full documentation, go read "element" in HTML::Widget. Go on, I'll wait. πŸ‘€

⭐ push_content ⭐

Add previously-created elements to the end of this block's elements. Back of the line, babe.

🧚 unshift_content 🧚

Add previously-created elements to the start of this block's elements. Front of the line, main character energy only. πŸ‘‘

πŸ“ block_container πŸ“

Creates a new block container object of type $self->block_container_class. Defaults to HTML::Widget::BlockContainer. So polite of it to have a default. 😌

πŸ’œ block_container_class πŸ’œ

Sets the class to be used by $self->block_container. And plot twist β€” you can call it as a class method or an instance method. Flexible icon behaviour. ✨

πŸ”₯ containerize πŸ”₯

Containerizes the block and all its contained elements so they're ready for later rendering. It uses HTML::Widget::BlockContainer by default, but you can over-ride that on a class or instance basis via block_container_class. You're in charge, periodt.

πŸ’– get_elements πŸ’–

my @elements = $self->get_elements;

my @elements = $self->get_elements( type => 'Textfield' );

my @elements = $self->get_elements( name => 'username' );

Returns a list of all elements added to the widget.

  • If a 'type' argument is given, it only returns the elements of that type.
  • If a 'name' argument is given, it only returns the elements with that name.

Filtered. Curated. Slay. πŸ’…

πŸŽ€ get_element πŸŽ€

my $element = $self->get_element;

my $element = $self->get_element( type => 'Textfield' );

my $element = $self->get_element( name => 'username' );

Basically get_elements(), but it only returns the first element in the list. Just the one. The chosen one.

Accepts the same arguments as get_elements(). 🫢

🌟 find_elements 🌟

Similar to get_elements(), and it has the same alternate forms, but this one does a recursive search through itself and all its child elements. It goes deep. It finds things. No cap. πŸ”βœ¨


πŸ‘€ SEE ALSO πŸ‘€

  • HTML::Widget::Element

🫢 AUTHOR 🫢

Michael Gray, "mjg@cpan.org" β€” iconic, honestly.


πŸ“œ LICENSE πŸ“œ

This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.


And that's the whole page, bestie!! This one's from perl v5.36.0, dated 2023-08-10, and it lives in the User Contributed Perl Documentation under HTML::...:Block(3pm). Mwah, go forth and block-level-element responsibly πŸ’–πŸŽ€πŸ¦‹
πŸ“¦ where this page comes from