Skip to content
Snippets Groups Projects
Commit 24029a65 authored by jaapjansma's avatar jaapjansma
Browse files

Added handling of upload files

parent 7bd2359b
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,8 @@ Version 1.3
===========
* Implemented the help text of an action on the edit action screen.
* Fix for converting Title into Name
* Added a File type for handling the upload of files.
* Fix for converting Title into Name.
Version 1.2
===========
......
......@@ -34,6 +34,7 @@
$this->addType(new MailingGroupType('MailingGroup', E::ts('Mailing Group')));
$this->addType(new ParticipantStatusType('ParticipantStatusType', E::ts('Participant Status')));
$this->addType(new CampaignType('CampaignType', E::ts('Campaign')));
$this->addType(new FileType('file', E::ts('File')));
}
/**
......
<?php
/**
* @author Jaap Jansma (CiviCooP) <jaap.jansma@civicoop.org>
* @license http://www.gnu.org/licenses/agpl-3.0.html
*/
namespace Civi\FormProcessor\Type;
use \Civi\FormProcessor\Type\GenericType;
use \Civi\FormProcessor\Config\Specification;
use \Civi\FormProcessor\Config\SpecificationBag;
use \CRM_FormProcessor_ExtensionUtil as E;
class FileType extends GenericType {
/**
* Get the configuration specification.
*
* The configuration is
* format: a string containing the input format.
* see for valid formats http://nl1.php.net/manual/en/datetime.createfromformat.php#refsect1-datetime.createfromformat-parameters
*
* @return SpecificationBag
*/
public function getConfigurationSpecification() {
return new SpecificationBag(array());
}
public function validateValue($value, $allValues=array()) {
if (!is_array($value)) {
return false;
}
if (!isset($value['id'])) {
if (!isset($value['name']) || !isset($value['mime_type']) || !isset($value['content'])) {
return false;
}
}
return true;
}
/**
* Returns the type number from CRM_Utils_Type
*/
public function getCrmType() {
return \CRM_Utils_Type::T_BLOB;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment