コード例 #1
0
ファイル: decimal.php プロジェクト: cepharum/txf
 public function beforeStoring(model_editor $editor, model $item = null, $itemProperties, model_editor_field $field)
 {
     $itemProperties = parent::beforeStoring($editor, $item, $itemProperties, $field);
     $name = $editor->fieldToProperty($field->name());
     if (array_key_exists($name, $itemProperties)) {
         $itemProperties[$name] = static::internationalFormat($itemProperties[$name], true);
     }
     return $itemProperties;
 }
コード例 #2
0
ファイル: items.php プロジェクト: cepharum/txf
 public function validate($input, $property, model_editor $editor)
 {
     parent::validate($input, $property, $editor);
     $items = preg_split('/[' . preg_quote($this->separator) . ']/', $input);
     if ($this->minCount > 0 && $this->minCount > count($items)) {
         throw new \InvalidArgumentException(\de\toxa\txf\_L('Provide additional information here!'));
     }
     if ($this->maxCount > 0 && $this->maxCount < count($items)) {
         throw new \InvalidArgumentException(\de\toxa\txf\_L('Provide less information here!'));
     }
     return true;
 }