You would like to request a very special value from your users and you couldn’t do this with the integrated field types?
You could integrate you own fieldtypes!
Add a file in /modules/Workflow2/extends/fieldtypes/ with the filename “<individual>.inc.php“
This file must contain a class which extends from \Workflow\Fieldtype.
This class must have the following structure:
<?php
namespace Workflow\Plugins\Fieldtypes;
class [IndividualNameA] extends \Workflow\Fieldtype
{
/**
* Should return every fieldtype this class will provide
*
* @param $moduleName - The moduleName of the Workflow, which include this field
* @return array - An Array with the following Structure
* array(
* array(
'id' => '<uniqueFieldTypeID>',
'title' => '<NameOfFieldType>',
'config' => $config
* ), ...
* )
$config is an array of configuration fields, the admin needs to configure in backend
* it must have the following structure
* array(
* '<configKey>' => array(
'type' => '[templatefield,templatearea,picklist,checkbox]',
* 'label' => '<label Of Configuration Input>',
// if type = checkbox
// 'value' => 1
// if type = picklist
// 'options' => array('ID1' => 'value1', 'ID2' => 'value2', ...)
* ), ...
* )
*
*/
public function getFieldTypes($moduleName) {
$fields = array();
/*
Example:
$fields[] = array(
'id' => 'reference',
'title' => 'Referenz',
'config' => array(
'reference' => array(
'type' => 'picklist',
'label' => 'Referenz',
'options' => $relmodules,
)
)
);
*/
return $fields;
}
/**
* @param $data - Config Array of this Input with the following Structure
* array(
* 'label' => 'Label the Function should use',
* 'name' => 'The Fieldname, which should used as name attribute',
* 'config' => Key-Value Array with all configurations, done by admin
* )
* @param \Workflow\VTEntity $context - Current Record, which is assigned to the Workflow
* @return array - The rendered content, shown to the user with the following structure
* array(
* 'html' => '<htmlContentOfThisInputField>',
* 'javascript' => 'A Javascript executed after html is shown'
* )
*
*/
public function renderFrontend($data, $context) {
$html = '';
$script = '';
return array('html' => $html, 'javascript' => $script);
}
}
// The class neeeds to be registered
\Workflow\Fieldtype::register('[IndividualNameA]', '\Workflow\Plugins\Fieldtypes\[IndividualNameA]');
Artikel-PDF herunterladen