示例#1
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']);
 }
示例#2
0
 public function getData(WysiwygOption $option)
 {
     $data = array('formats' => $this->getConfig('formats'), 'toolbar1' => $option->getToolbar1($this->getConfig('toolbar1')), 'toolbar2' => $option->getToolbar2($this->getConfig('toolbar2')), 'height' => $option->getHeight($this->getConfig('height')), 'style_formats' => $option->getFormats($this->getConfig('style_formats')), 'content_css' => $option->getContentCss($this->getConfig('content_css')));
     return json_encode($data);
 }