function Style::getTagAndClasses

Same name in other branches
  1. 9 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Style.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Style::getTagAndClasses()
  2. 10 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Style.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Style::getTagAndClasses()

Gets the tag and classes for a parsed style element.

@internal

Parameters

\Drupal\ckeditor5\HTMLRestrictions $style_element: A parsed style element.

Return value

array An array containing two values:

  • a HTML tag name
  • a list of classes
3 calls to Style::getTagAndClasses()
Style::buildConfigurationForm in core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Style.php
Style::getDynamicPluginConfig in core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Style.php
Allows a plugin to modify its static configuration.
StyleSensibleElementConstraintValidator::validate in core/modules/ckeditor5/src/Plugin/Validation/Constraint/StyleSensibleElementConstraintValidator.php

File

core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Style.php, line 59

Class

Style
CKEditor 5 Style plugin configuration.

Namespace

Drupal\ckeditor5\Plugin\CKEditor5Plugin

Code

public static function getTagAndClasses(HTMLRestrictions $style_element) : array {
    $tag = array_keys($style_element->getAllowedElements())[0];
    $classes = array_keys($style_element->getAllowedElements()[$tag]['class']);
    return [
        $tag,
        $classes,
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.