I've been looking at this code trying to understand how i can tell the $element type within my filter method implementation. Instead of applying a callback here I think it would be better to have an optional method on each element which would be defined as part of the form definition. The default of course would be 'div'.
class WP_Form_Decorator_HtmlTag extends WP_Form_Decorator {
// TODO: some sort of callback for context-aware attributes
public function render( WP_Form_Component $element ) {
$args = wp_parse_args(
$this->args,
array(
// apply_filters('wp_form_htmltag_default', 'div'),
'tag' =>$element->get_htmltag_default(),
'attributes' => array(),
)
);
return $this->open_tag($args['tag'], $args['attributes']) . $this->component_view->render($element) . $this->close_tag($args['tag']);
}
```ruby
Hey,
I've been looking at this code trying to understand how i can tell the $element type within my filter method implementation. Instead of applying a callback here I think it would be better to have an optional method on each element which would be defined as part of the form definition. The default of course would be 'div'.