Skip to content

Instantly share code, notes, and snippets.

@NamelessCoder
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NamelessCoder/9582594 to your computer and use it in GitHub Desktop.
Save NamelessCoder/9582594 to your computer and use it in GitHub Desktop.
<?php
namespace MyVendor\MyExt\Form;
class CustomForm extends \FluidTYPO3\Flux\Form {
/**
* Creates objects inserted into this Form, resulting in
* a nested set of PHP objects that correspond exactly
* to what would come out of parsing a Flux template
*/
public function initializeObject() {
$this->createField('Input', 'test')->setDefault('default value')->setRequired(TRUE);
}
}
<?php
namespace MyVendor\MyExt\Provider;
class CustomProvider extends \FluidTYPO3\Flux\Provider\ContentProvider implements \FluidTYPO3\Flux\Provider\ProviderInterface {
/**
* Gets a special Form instance, if one applies, to be returned
* instead of the basic Flux Form instance
*/
public function getForm(array $row) {
$templateFile = $this->getTemplatePathAndFilename($row);
switch (basename($templateFile)) {
...
case 'whatever.html':
$form = $this->objectManager->get('MyVendor\MyExt\Form\CustomForm');
break;
}
return $form;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment