/**
  * @covers ::getEnabledButtons
  * @dataProvider providerGetEnabledButtons
  */
 public function testGetEnabledButtons(array $toolbar_rows, array $expected_buttons)
 {
     $editor = $this->prophesize(Editor::class);
     $editor->getSettings()->willReturn(['toolbar' => ['rows' => $toolbar_rows]]);
     $enabled_buttons = CKEditorPluginManager::getEnabledButtons($editor->reveal());
     $this->assertEquals($expected_buttons, $enabled_buttons);
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function getConfig(Editor $editor)
 {
     // Reasonable defaults that provide expected basic behavior.
     $config = array('customConfig' => '', 'pasteFromWordPromptCleanup' => TRUE, 'resize_dir' => 'vertical', 'justifyClasses' => array('text-align-left', 'text-align-center', 'text-align-right', 'text-align-justify'), 'entities' => FALSE, 'disableNativeSpellChecker' => FALSE);
     // Add the allowedContent setting, which ensures CKEditor only allows tags
     // and attributes that are allowed by the text format for this text editor.
     list($config['allowedContent'], $config['disallowedContent']) = $this->generateACFSettings($editor);
     // Add the format_tags setting, if its button is enabled.
     $toolbar_buttons = CKEditorPluginManager::getEnabledButtons($editor);
     if (in_array('Format', $toolbar_buttons)) {
         $config['format_tags'] = $this->generateFormatTagsSetting($editor);
     }
     return $config;
 }