Builds the "format_tags" configuration part of the CKEditor JS settings.
\Drupal\editor\Plugin\Core\Entity\Editor $editor: A configured text editor object.
array An array containing the "format_tags" configuration.
getConfig()
protected function generateFormatTagsSetting(Editor $editor) {
// The <p> tag is always allowed — HTML without <p> tags is nonsensical.
$format_tags = array(
'p',
);
// Given the list of possible format tags, automatically determine whether
// the current text format allows this tag, and thus whether it should show
// up in the "Format" dropdown.
$possible_format_tags = array(
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'pre',
);
foreach ($possible_format_tags as $tag) {
$input = '<' . $tag . '>TEST</' . $tag . '>';
$output = trim(check_markup($input, $editor->format));
if ($input == $output) {
$format_tags[] = $tag;
}
}
return implode(';', $format_tags);
}