From 42c8fea9e063a3d1b1071a0bad9fc211a5308fb4 Mon Sep 17 00:00:00 2001 From: Adam Kadlec Date: Mon, 2 Mar 2015 11:05:58 +0100 Subject: [PATCH] - Refactored to nette 2.3 --- src/IPub/FormDateTime/Controls/Time.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/IPub/FormDateTime/Controls/Time.php b/src/IPub/FormDateTime/Controls/Time.php index 0267671..102b555 100644 --- a/src/IPub/FormDateTime/Controls/Time.php +++ b/src/IPub/FormDateTime/Controls/Time.php @@ -141,6 +141,12 @@ public function getControlPart($key) $name = $this->getHtmlName(); if ($key === static::FIELD_NAME_TIME) { + if (method_exists('Nette\Forms\Helpers', 'exportRules')) { + $exportedRules = Forms\Helpers::exportRules($this->rules); + } else { + $exportedRules = self::exportRules($this->rules); + } + $control = Utils\Html::el('input'); $control->addAttributes([ 'name' => ($name . '[' . static::FIELD_NAME_TIME . ']'), @@ -148,7 +154,7 @@ public function getControlPart($key) 'value' => $this->value ? $this->value->format($this->toPhpFormat($this->timeFormat)) : NULL, 'required' => $this->isRequired(), 'disabled' => $this->isDisabled(), - 'data-nette-rules' => self::exportRules($this->rules) ?: NULL, + 'data-nette-rules' => $exportedRules ?: NULL, ]); if ($this->disabled) { @@ -363,4 +369,4 @@ public static function register($timeFormat = self::W3C_TIME_FORMAT, $language = } ); } -} \ No newline at end of file +}