Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
form-processor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mattwire
form-processor
Commits
24029a65
Commit
24029a65
authored
5 years ago
by
jaapjansma
Browse files
Options
Downloads
Patches
Plain Diff
Added handling of upload files
parent
7bd2359b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+2
-1
2 additions, 1 deletion
CHANGELOG.md
Civi/FormProcessor/Type/Factory.php
+1
-0
1 addition, 0 deletions
Civi/FormProcessor/Type/Factory.php
Civi/FormProcessor/Type/FileType.php
+53
-0
53 additions, 0 deletions
Civi/FormProcessor/Type/FileType.php
with
56 additions
and
1 deletion
CHANGELOG.md
+
2
−
1
View file @
24029a65
...
...
@@ -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
===========
...
...
This diff is collapsed.
Click to expand it.
Civi/FormProcessor/Type/Factory.php
+
1
−
0
View file @
24029a65
...
...
@@ -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'
)));
}
/**
...
...
This diff is collapsed.
Click to expand it.
Civi/FormProcessor/Type/FileType.php
0 → 100644
+
53
−
0
View file @
24029a65
<?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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment