Skip to content
This repository has been archived by the owner on Feb 17, 2020. It is now read-only.

Commit

Permalink
- Refactored to nette 2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
akadlec committed Mar 2, 2015
1 parent 4cb4bad commit 42c8fea
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/IPub/FormDateTime/Controls/Time.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,20 @@ 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 . ']'),
'type' => 'text',
'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) {
Expand Down Expand Up @@ -363,4 +369,4 @@ public static function register($timeFormat = self::W3C_TIME_FORMAT, $language =
}
);
}
}
}

0 comments on commit 42c8fea

Please sign in to comment.