getPlainTagsSubset example


  public static function isCreatableElement(string $element): bool {
    return !HTMLRestrictions::fromString($element)
      ->getPlainTagsSubset()
      ->allowsNothing();
  }

  /** * Whether this plugin allows creating/editing elements and attributes. * * @return bool * * @see \Drupal\ckeditor5\Annotation\DrupalAspectsOfCKEditor5Plugin::$elements */
  public function hasElements(): bool {
    
/** * @covers ::getWildcardSubset * @covers ::getConcreteSubset * @covers ::getPlainTagsSubset * @covers ::extractPlainTagsSubset * @dataProvider providerSubsets */
  public function testSubsets(HTMLRestrictions $input, HTMLRestrictions $expected_wildcard_subset, HTMLRestrictions $expected_concrete_subset, HTMLRestrictions $expected_plain_tags_subset, HTMLRestrictions $expected_extracted_plain_tags_subset): void {
    $this->assertEquals($expected_wildcard_subset$input->getWildcardSubset());
    $this->assertEquals($expected_concrete_subset$input->getConcreteSubset());
    $this->assertEquals($expected_plain_tags_subset$input->getPlainTagsSubset());
    $this->assertEquals($expected_extracted_plain_tags_subset$input->extractPlainTagsSubset());
  }

  public function providerSubsets(): \Generator {
    yield 'empty set' => [
      new HTMLRestrictions([]),
      new HTMLRestrictions([]),
      new HTMLRestrictions([]),
      new HTMLRestrictions([]),
      new HTMLRestrictions([]),
    ];

    
Home | Imprint | This part of the site doesn't use cookies.