Skip to content

Commit cc15a5d

Browse files
committed
WEBDOM-281 : form type implementation added
1 parent ceaa4df commit cc15a5d

File tree

2 files changed

+50
-3
lines changed

2 files changed

+50
-3
lines changed

Entity/DrupalSevenApplication.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace DigipolisGent\Domainator9k\AppTypes\DrupalSevenBundle\Entity;
44

5+
use DigipolisGent\Domainator9k\AppTypes\DrupalSevenBundle\Form\Type\DrupalSevenApplicationFormType;
56
use DigipolisGent\Domainator9k\CoreBundle\Entity\AbstractApplication;
67
use Doctrine\ORM\Mapping as ORM;
78
use Symfony\Component\Validator\Constraints as Assert;
@@ -26,12 +27,22 @@ class DrupalSevenApplication extends AbstractApplication
2627
*/
2728
protected $installProfile;
2829

29-
30-
public static function getType()
30+
/**
31+
* @return string
32+
*/
33+
public static function getApplicationType(): string
3134
{
3235
return self::TYPE;
3336
}
3437

38+
/**
39+
* @return string
40+
*/
41+
public static function getFormType(): string
42+
{
43+
return DrupalSevenApplicationFormType::class;
44+
}
45+
3546
/**
3647
* @return string
3748
*/
@@ -54,7 +65,7 @@ public function setInstallProfile(string $installProfile)
5465
public static function getTemplateReplacements(): array
5566
{
5667
$templateReplacements = parent::getTemplateReplacements();
57-
$templateReplacements['installProfile()'] = 'getInstallProfile()';
68+
$templateReplacements['installProfile()'] = 'getInstallProfile()';
5869

5970
return $templateReplacements;
6071
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
4+
namespace DigipolisGent\Domainator9k\AppTypes\DrupalSevenBundle\Form\Type;
5+
6+
use DigipolisGent\Domainator9k\AppTypes\DrupalSevenBundle\Entity\DrupalSevenApplication;
7+
use DigipolisGent\Domainator9k\CoreBundle\Form\Type\AbstractApplicationFormType;
8+
use Symfony\Component\Form\FormBuilderInterface;
9+
use Symfony\Component\OptionsResolver\OptionsResolver;
10+
11+
/**
12+
* Class DrupalSevenApplicationFormType
13+
* @package DigipolisGent\Domainator9k\AppTypes\DrupalSevenBundle\Form\Type
14+
*/
15+
class DrupalSevenApplicationFormType extends AbstractApplicationFormType
16+
{
17+
18+
/**
19+
* @param FormBuilderInterface $builder
20+
* @param array $options
21+
*/
22+
public function buildForm(FormBuilderInterface $builder, array $options)
23+
{
24+
parent::buildForm($builder, $options);
25+
$builder->add('installProfile');
26+
}
27+
28+
/**
29+
* @param OptionsResolver $resolver
30+
*/
31+
public function configureOptions(OptionsResolver $resolver)
32+
{
33+
parent::configureOptions($resolver);
34+
$resolver->setDefault('data_class',DrupalSevenApplication::class);
35+
}
36+
}

0 commit comments

Comments
 (0)