From 7516b6772390226d61e168564b883a0f2429dc00 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Sun, 8 Feb 2015 17:50:13 +0200 Subject: [PATCH] extra attrs for widget and label --- ipf/form/boundfield.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ipf/form/boundfield.php b/ipf/form/boundfield.php index f997d3d..41defe2 100644 --- a/ipf/form/boundfield.php +++ b/ipf/form/boundfield.php @@ -42,14 +42,12 @@ class IPF_Form_BoundField return $this->form->initial($this->name); } - public function renderWidget() + public function renderWidget($extra_attrs=array()) { $widget = $this->field->widget; - $extra_attrs = array(); - if (!array_key_exists('id', $widget->attrs)) { + if (!array_key_exists('id', $widget->attrs)) $extra_attrs['id'] = $this->autoId(); - } if ($widget->embeds_errors) $extra_attrs['errors'] = $this->errors; @@ -65,9 +63,10 @@ class IPF_Form_BoundField return IPF_Form::renderErrorsAsHTML($this->errors); } - public function renderLabel() + public function renderLabel($extra_attrs=array()) { $label = Tag::label() + ->attrs($extra_attrs) ->append($this->label); $widget = $this->field->widget; -- 2.49.0