Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit02bd689

Browse files
alexander-schranzfabpot
authored andcommitted
Add block prefix to csrf token field
1 parent6ca3974 commit02bd689

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

‎src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ public function finishView(FormView $view, FormInterface $form, array $options)
9090
$tokenId =$options['csrf_token_id'] ?: ($form->getName() ?:\get_class($form->getConfig()->getType()->getInnerType()));
9191
$data = (string)$options['csrf_token_manager']->getToken($tokenId);
9292

93-
$csrfForm =$factory->createNamed($options['csrf_field_name'],'Symfony\Component\Form\Extension\Core\Type\HiddenType',$data,array(
93+
$csrfForm =$factory->createNamed($options['csrf_field_name'],'Symfony\Component\Form\Extension\Core\Type\HiddenType',$data, [
94+
'block_prefix' =>'csrf_token',
9495
'mapped' =>false,
95-
));
96+
]);
9697

9798
$view->children[$options['csrf_field_name']] =$csrfForm->createView($view);
9899
}
@@ -103,20 +104,20 @@ public function finishView(FormView $view, FormInterface $form, array $options)
103104
*/
104105
publicfunctionconfigureOptions(OptionsResolver$resolver)
105106
{
106-
$resolver->setDefaults(array(
107+
$resolver->setDefaults([
107108
'csrf_protection' =>$this->defaultEnabled,
108109
'csrf_field_name' =>$this->defaultFieldName,
109110
'csrf_message' =>'The CSRF token is invalid. Please try to resubmit the form.',
110111
'csrf_token_manager' =>$this->defaultTokenManager,
111112
'csrf_token_id' =>null,
112-
));
113+
]);
113114
}
114115

115116
/**
116117
* {@inheritdoc}
117118
*/
118119
publicstaticfunctiongetExtendedTypes():iterable
119120
{
120-
returnarray(FormType::class);
121+
return[FormType::class];
121122
}
122123
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp