FillPdfFormFieldForm.php in FillPDF 8.4
File
src/Form/FillPdfFormFieldForm.php
View source
<?php
namespace Drupal\fillpdf\Form;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Entity\EntityRepositoryInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\fillpdf\FillPdfAdminFormHelperInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class FillPdfFormFieldForm extends ContentEntityForm {
protected $adminFormHelper;
public function __construct(EntityRepositoryInterface $entity_repository, FillPdfAdminFormHelperInterface $admin_form_helper) {
parent::__construct($entity_repository);
$this->adminFormHelper = $admin_form_helper;
}
public static function create(ContainerInterface $container) {
return new static($container
->get('entity.repository'), $container
->get('fillpdf.admin_form_helper'));
}
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$form['prefix']['widget']['0']['value']['#rows'] = 3;
$form['value']['token_help'] = $this->adminFormHelper
->getAdminTokenForm();
$form['suffix']['widget']['0']['value']['#rows'] = 3;
$form['extra'] = [
'#type' => 'details',
'#title' => $this
->t('Transform values'),
];
$form['replacements']['#group'] = 'extra';
return $form;
}
public function save(array $form, FormStateInterface $form_state) {
$entity = $this->entity;
$form_state
->setRedirect('entity.fillpdf_form.edit_form', [
'fillpdf_form' => $this->entity->fillpdf_form->target_id,
]);
return parent::save($form, $form_state);
}
}