예제 #1
0
 public function testTemplates()
 {
     $templates = array('default' => array('imagesPath' => '/my/path', 'templates' => array(array('title' => 'My Template', 'html' => '<h1>Template</h1><p>Type your text here.</p>'))));
     $this->templateManager->setTemplates($templates);
     $this->assertTrue($this->templateManager->hasTemplates());
     $this->assertTrue($this->templateManager->hasTemplate('default'));
     $this->assertSame($templates, $this->templateManager->getTemplates());
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->setAttribute('enable', $options['enable']);
     if ($builder->getAttribute('enable')) {
         $builder->setAttribute('base_path', $options['base_path']);
         $builder->setAttribute('js_path', $options['js_path']);
         $config = $options['config'];
         if ($options['config_name'] === null) {
             $name = uniqid('ivory', true);
             $options['config_name'] = $name;
             $this->configManager->setConfig($name, $config);
         } else {
             $this->configManager->mergeConfig($options['config_name'], $config);
         }
         $this->pluginManager->setPlugins($options['plugins']);
         $this->stylesSetManager->setStylesSets($options['styles']);
         $this->templateManager->setTemplates($options['templates']);
         $builder->setAttribute('config', $this->configManager->getConfig($options['config_name']));
         $builder->setAttribute('plugins', $this->pluginManager->getPlugins());
         $builder->setAttribute('styles', $this->stylesSetManager->getStylesSets());
         $builder->setAttribute('templates', $this->templateManager->getTemplates());
     }
 }