public function finishView(FormView $view, FormInterface $form, array $options) { parent::finishView($view, $form, $options); $view->vars['edit_mode_enabled'] = $options['edit_mode_enabled']; }
/** * Get and set an upload token for this upload form. * * @param FormView $view * @param FormInterface $form * @param array $options */ public function finishView(FormView $view, FormInterface $form, array $options) { parent::finishView($view, $form, $options); /* * Dump the last index (key) of attachment collection array into the view so we can * add new items without accidentally overriding already existing ones */ $data = $form->getData(); end($data); $key = key($data); $view->vars['attachment_index'] = $key; // dump the form's csrf token into the view $token = $this->tokenManager->getToken($view->vars['full_name']); $view->vars['_file_upload_token'] = $token->getValue(); }