示例#1
0
 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     $view->vars['id'] = uniqid(self::$uniqueIdPrefix++);
     $option = new WysiwygOption();
     $option->setFormats($options['formats']);
     $option->setToolbar1($options['toolbar1']);
     $option->setToolbar2($options['toolbar2']);
     $option->setHeight($options['height']);
     $option->setContentCss($options['content_css']);
     $view->vars['config'] = $this->config->getData($option);
 }
示例#2
0
 public function testFormats()
 {
     $defaultFormats = [['title' => 'hello', 'styles' => 'styles', 'inline' => 'span'], ['title' => 'hello2', 'styles' => 'styles', 'inline' => 'b']];
     $option = new WysiwygOption();
     $option->setFormats($defaultFormats);
     $formats = $option->getFormats();
     $this->assertTrue(is_array($formats), 'Format should be an array');
     $this->assertCount(2, $formats);
     $formats = $option->getFormats(['hello']);
     $this->assertTrue(is_array($formats), 'Format should be an array');
     $this->assertCount(1, $formats);
     $this->assertArrayHasKey('title', $formats[0]);
     $this->assertEquals('hello', $formats[0]['title']);
 }