public function buildConfigurationForm(array
$form, FormStateInterface
$form_state) { $form['styles'
] =
[ '#title' =>
$this->
t('Styles'
),
'#type' => 'textarea',
'#description' =>
$this->
t('A list of classes that will be provided in the "Style" dropdown. Enter one or more classes on each line in the format: element.classA.classB|Label. Example: h1.title|Title. Advanced example: h1.fancy.title|Fancy title.<br />These styles should be available in your theme\'s CSS file.'
),
];
if (!
empty($this->configuration
['styles'
])) { $as_selectors = '';
foreach ($this->configuration
['styles'
] as $style) { [$tag,
$classes] = self::
getTagAndClasses(HTMLRestrictions::
fromString($style['element'
]));
$as_selectors .=
sprintf("%s.%s|%s\n",
$tag,
implode('.',
$classes),
$style['label'
]);
} $form['styles'
]['#default_value'
] =
$as_selectors;
} return $form;
} /**
* Gets the tag and classes for a parsed style element.
*
* @param \Drupal\ckeditor5\HTMLRestrictions $style_element
* A parsed style element.
*
* @return array
* An array containing two values:
* - a HTML tag name
* - a list of classes
*
* @internal
*/