| 1 | package Gapp::Meta::Widget::Native::Role::FormElement; | ||
| 2 | { | ||
| 3 | $Gapp::Meta::Widget::Native::Role::FormElement::VERSION = '0.60'; | ||
| 4 | } | ||
| 5 | |||
| 6 | use Moose::Role; | ||
| 7 | use MooseX::SemiAffordanceAccessor; | ||
| 8 | |||
| 9 | |||
| 10 | #has 'form' => ( | ||
| 11 | # is => 'ro', | ||
| 12 | # lazy_build => 1, | ||
| 13 | # weak_ref => 1, | ||
| 14 | # predicate => 'has_form', | ||
| 15 | # clearer => 'clear_form', | ||
| 16 | #); | ||
| 17 | |||
| 18 | sub form { | ||
| 19 | my ( $self ) = @_; | ||
| 20 | |||
| 21 | my $node = $self; | ||
| 22 | while ( $node ) { | ||
| 23 | return $node if $node->does('Gapp::Meta::Widget::Native::Trait::Form'); | ||
| 24 | return if ! $node->parent; | ||
| 25 | $node = $node->parent; | ||
| 26 | } | ||
| 27 | } | ||
| 28 | |||
| 29 | 1; |