Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 5c67b12

Browse files
committed
Use PHP's if statements to avoid code evaluation
1 parent a158791 commit 5c67b12

File tree

1 file changed

+38
-34
lines changed

1 file changed

+38
-34
lines changed

src/Admin/Routing/RouteAdmin.php

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -58,42 +58,46 @@ protected function configureFormFields(FormMapper $formMapper)
5858
)
5959
->add('name', TextType::class)
6060
->end() // group location
61+
;
6162

62-
->ifTrue(null === $this->getParentFieldDescription())
63-
->with('form.group_target', ['class' => 'col-md-9'])
64-
->add(
65-
'content',
66-
TreeSelectType::class,
67-
['root_node' => $this->contentRoot, 'widget' => 'browser', 'required' => false]
68-
)
69-
->end() // group general
70-
->end() // tab general
71-
72-
->tab('form.tab_routing')
73-
->with('form.group_path', ['class' => 'col-md-6'])
74-
->add(
75-
'variablePattern',
76-
TextType::class,
77-
['required' => false],
78-
['help' => 'form.help_variable_pattern']
79-
)
80-
->add(
81-
'options',
82-
ImmutableArrayType::class,
83-
['keys' => $this->configureFieldsForOptions($this->getSubject()->getOptions())],
84-
['help' => 'form.help_options']
85-
)
86-
->end() // group path
87-
88-
->with('form.group_defaults', ['class' => 'col-md-6'])
89-
->add(
90-
'defaults',
91-
ImmutableArrayType::class,
92-
['label' => false, 'keys' => $this->configureFieldsForDefaults($this->getSubject()->getDefaults())]
93-
)
94-
->end() // group data
95-
->ifEnd()
63+
if (null === $this->getParentFieldDescription()) {
64+
$formMapper
65+
->with('form.group_target', ['class' => 'col-md-9'])
66+
->add(
67+
'content',
68+
TreeSelectType::class,
69+
['root_node' => $this->contentRoot, 'widget' => 'browser', 'required' => false]
70+
)
71+
->end() // group general
72+
->end() // tab general
9673

74+
->tab('form.tab_routing')
75+
->with('form.group_path', ['class' => 'col-md-6'])
76+
->add(
77+
'variablePattern',
78+
TextType::class,
79+
['required' => false],
80+
['help' => 'form.help_variable_pattern']
81+
)
82+
->add(
83+
'options',
84+
ImmutableArrayType::class,
85+
['keys' => $this->configureFieldsForOptions($this->getSubject()->getOptions())],
86+
['help' => 'form.help_options']
87+
)
88+
->end() // group path
89+
90+
->with('form.group_defaults', ['class' => 'col-md-6'])
91+
->add(
92+
'defaults',
93+
ImmutableArrayType::class,
94+
['label' => false, 'keys' => $this->configureFieldsForDefaults($this->getSubject()->getDefaults())]
95+
)
96+
->end() // group data
97+
;
98+
}
99+
100+
$formMapper
97101
->end(); // tab general/routing
98102

99103
$this->addTransformerToField($formMapper->getFormBuilder(), 'parentDocument');

0 commit comments

Comments
 (0)