1. Go to this page and download the library: Download fluidtypo3/flux library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fluidtypo3 / flux example snippets
$form = \FluidTYPO3\Flux\Form::create();
$form->setName('myform');
$form->createField('Input', 'myField', 'My special field');
namespace My\Extension\Transformation;
use FluidTYPO3\Flux\Attribute\DataTransformer;
use FluidTYPO3\Flux\Form\ContainerInterface;
use FluidTYPO3\Flux\Form\FieldInterface;
use FluidTYPO3\Flux\Form\FormInterface;
use FluidTYPO3\Flux\Form\Transformation\DataTransformerInterface;
/* PHP 8.0 registration with class attribute. ID must be unique! */
#[DataTransformer('myextension.datatransformer.mytransform')]
class MyTransformer implements DataTransformerInterface
{
public function canTransformToType(string $type): bool
{
// Support transform of any type that begins with "myextension:"
return strpos($type, 'myextension:') === 0;
}
public function getPriority(): int
{
// Higher priority means your DataTransformer is checked before others with lower priority.
return 10;
}
/**
* @var FieldInterface|ContainerInterface $component
* @var mixed $value
* @return mixed
*/
public function transform(FormInterface $component, string $type, $value)
{
$converted = null;
switch ($type) {
case 'myextension:foo':
$converted = 'call something to transform $value to one type';
break;
case 'myextension:bar':
$converted = 'call something else to transform $value to another type';
break;
}
return $converted;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.