Beispiel #1
0
 public function toArray()
 {
     $out = parent::toArray();
     $out['format'] = Mesour\Components\Utils\Helpers::convertDateToJsFormat($this->format);
     $out['nullable'] = $this->isNullable();
     return $out;
 }
Beispiel #2
0
 public function createHiddenInput($data = [], $referenceSettings = [])
 {
     /** @var Mesour\Icon\IIcon $icon */
     $className = $this->getIconClass();
     $icon = new $className();
     $referenceData = [];
     foreach ($this->source->getDataStructure()->getTableStructures() as $tableStructure) {
         $source = $this->getSource()->getReferencedSource($tableStructure->getName());
         if ($source->getTotalCount() <= self::$maxCheckboxCount) {
             $referenceData[$tableStructure->getName()] = $source->fetchFullData($this->getDateFormat());
         }
     }
     $hidden = $this->getHiddenPrototype();
     $attributes = ['data-mesour-data' => Nette\Utils\Json::encode($data), 'value' => Nette\Utils\Json::encode($this->getValues()), 'data-references' => Nette\Utils\Json::encode(array_merge([self::PREDEFINED_KEY => $this->predefinedData], $referenceData)), 'data-mesour-date' => $this->getDateFormat(), 'data-icon-prefix' => $icon->getPrefix(), 'data-icons' => Nette\Utils\Json::encode(self::$icons), 'data-mesour-js-date' => Mesour\Components\Utils\Helpers::convertDateToJsFormat($this->getDateFormat())];
     $hidden->addAttributes($attributes);
     return $hidden;
 }