getElementsSubset example



      $defined_elements = $definition->getElements();
      if (is_a($definition->getClass(), CKEditor5PluginElementsSubsetInterface::class, TRUE)) {
        // ckeditor5_sourceEditing is the edge case here: it is the only plugin         // that is allowed to return a superset. It's a special case because it         // is through configuring this particular plugin that additional HTML         // tags can be allowed.         // The list of tags it supports is generated dynamically. In its default         // configuration it does support any HTML tags.         if ($id === 'ckeditor5_sourceEditing') {
          $defined_elements = !isset($editor) ? [] : $this->getPlugin($id$editor)->getElementsSubset();
        }
        // The default case: all other plugins that implement this interface are         // explicitly checked for compliance: only subsets are allowed. This is         // essential for \Drupal\ckeditor5\SmartDefaultSettings to be able to         // work: otherwise it would not be able to know which plugins to enable.         elseif (isset($editor)) {
          $subset = $this->getPlugin($id$editor)->getElementsSubset();
          $subset_restrictions = HTMLRestrictions::fromString(implode($subset));
          $defined_restrictions = HTMLRestrictions::fromString(implode($defined_elements));
          // Determine max supported elements by resolving wildcards in the           // restrictions defined by the plugin.
Home | Imprint | This part of the site doesn't use cookies.