FilterTestAssets.php

Same filename in other branches
  1. 9 core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestAssets.php
  2. 8.9.x core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestAssets.php
  3. 10 core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestAssets.php

Namespace

Drupal\filter_test\Plugin\Filter

File

core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestAssets.php

View source
<?php

declare (strict_types=1);
namespace Drupal\filter_test\Plugin\Filter;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\filter\Attribute\Filter;
use Drupal\filter\FilterProcessResult;
use Drupal\filter\Plugin\FilterBase;
use Drupal\filter\Plugin\FilterInterface;

/**
 * Provides a test filter to attach assets.
 */
class FilterTestAssets extends FilterBase {
    
    /**
     * {@inheritdoc}
     */
    public function process($text, $langcode) {
        $result = new FilterProcessResult($text);
        $result->addAttachments([
            'library' => [
                'filter/caption',
            ],
        ]);
        return $result;
    }

}

Classes

Title Deprecated Summary
FilterTestAssets Provides a test filter to attach assets.

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