1 ckeditor.admin.inc _ckeditor_settings_parse_style_list($style_list_string)

Parse a string of styles in the format of element.class|Label into an array.


string $style_list_string: A list of styles separated by new line characters.

Return value

array: An unindexed array of styles with the following keys:

  • name: The label of the style.
  • element: The type of element this still will use.
  • attributes: An attributes array including the class that will be used. Note that the class is not an array, as this configuration is passed directly to CKEditor.


core/modules/ckeditor/ckeditor.admin.inc, line 122
Admin page callbacks for the CKEditor module.


function _ckeditor_settings_parse_style_list($style_list_string) {
  $styles = array();
  foreach (explode("\n", $style_list_string) as $style) {
    $style = trim($style);
    if ($style) {
      @list($element, $label) = explode('|', $style, 2);
      @list($element, $class) = explode('.', $element, 2);
      $styles[] = array(
        'name' => $label,
        'element' => $element,
        'attributes' => array('class' => $class),
  return $styles;