/** * {@inheritdoc} */ public function buildView(FormView $view, FormInterface $form, array $options) { $config = array('mime_types' => $options['mime_types'], 'max_file_size' => $options['max_file_size'], 'max_height' => $options['max_height'], 'max_width' => $options['max_width'], 'min_height' => $options['min_height'], 'min_width' => $options['min_width'], 'resize_strategy' => $options['resize_strategy'], 'cropper_enabled' => $options['cropper_enabled'], 'cropper_coordinates' => $options['cropper_coordinates']); $view->vars['config'] = json_encode($config); $view->vars['image_path'] = $form->getData() ? $form->getData()->getPath() : null; $view->vars['upload_token'] = $this->tokenGenerator->generate($config); $view->vars['no_image'] = $this->noImage; }
public function testGenerate() { $data = array('Silvestra' => 'Media'); $this->assertEquals($this->getToken($data), $this->generator->generate($data)); }