Gets sorted style titles keyed by their names belonging to the given group.
If an empty string is given, returns all styles.
string $group: (optional) The style group. Defaults to empty string.
string $default_style_key: (optional) Default style key will be displayed first.
bool $access_check: (optional) Whether we should check the style access. Defaults to false.
array An array of style titles keyed by the respective style machine names.
protected function getStyleOptions($group = '', $default_style_key = '', $access_check = FALSE) {
$styles = $this->yamlStyleDiscovery
->getStyleOptions($group, $access_check);
if (isset($styles[$default_style_key])) {
// Show default selection as a first option in the list with dashes.
return [
$default_style_key => $this
->t('- @name -', [
'@name' => $styles[$default_style_key],
]),
] + $styles;
}
return $styles;
}