/** * set the value * * @param string $value value * @return \Ameos\AmeosForm\Elements\ElementAbstract this */ public function setValue($value) { if (is_array($value)) { $value = implode(',', $value); } parent::setValue($value); return $this; }
/** * set the value * * @param string $value value * @return \Ameos\AmeosForm\Elements\ElementAbstract this */ public function setValue($value) { if ($value == 0) { $value = ''; } parent::setValue($value); if ($value != '') { $this->pageRenderer->addJsFooterInlineCode('setvalue-datepicker-' . $this->getName() . '-' . $value, ' if(document.getElementById("' . $this->getHtmlId() . '-datepicker")) { document.getElementById("' . $this->getHtmlId() . '-datepicker").value = moment(' . $value . ', "X").format("' . $this->configuration['format'] . '"); } '); } else { $this->pageRenderer->addJsFooterInlineCode('setvalue-datepicker-' . $this->getName() . '-' . $value, ' if(document.getElementById("' . $this->getHtmlId() . '-datepicker")) { document.getElementById("' . $this->getHtmlId() . '-datepicker").value = ""; } '); } return $this; }
/** * set the value * * @todo : fal mode * @param string $value value * @return \Ameos\AmeosForm\Elements\ElementAbstract this */ public function setValue($value) { if (is_array($value)) { if (isset($value['upload']) && is_array($value['upload']) && $value['upload'][0]['name'] != '') { $this->value = $value; $this->determineErrors(); $currentValue = []; if ($this->isValid()) { foreach ($value['upload'] as $uploadFile) { $directory = $this->getUploadDirectory(); $filename = $this->getUploadFilename($uploadFile['name']); $temporaryFilepath = $this->getTemporaryUpdateFilepath($uploadFile['name']); GeneralUtility::upload_copy_move($uploadFile['tmp_name'], $temporaryFilepath); Events::getInstance($this->form->getIdentifier())->registerEvent('form_is_valid', [$this, 'moveTemporaryUploadedFile'], ['destinationFilepath' => $directory . $filename, 'temporaryFilepath' => $temporaryFilepath]); $this->uploadState = 'temporary-upload'; $currentValue[] = basename($temporaryFilepath); } parent::setValue($currentValue); } else { $this->value = null; } } elseif (isset($value['temporary'])) { $currentValue = []; foreach ($value['temporary'] as $uploadFile) { $directory = $this->getUploadDirectory(); $filename = $this->getUploadFilename($value['temporary']); Events::getInstance($this->form->getIdentifier())->registerEvent('form_is_valid', [$this, 'moveTemporaryUploadedFile'], ['destinationFilepath' => $directory . $filename, 'temporaryFilepath' => PATH_site . 'typo3temp/ameos_form/tempupload/' . $value['temporary']]); $this->uploadState = 'temporary-upload'; $currentValue[] = basename($temporaryFilepath); } parent::setValue($currentValue); } } else { if (is_string($this->value) && $this->value != '') { $value = $this->value . ',' . $value; } parent::setValue($value); } return $this; }